mdeserialize_sp
This commit is contained in:
parent
1cb0f4042b
commit
c7d69b9982
@ -169,21 +169,33 @@ impl<'a, Ctx: Context<'a>, SP: StaticPair<'a, Ctx>> ParseMode for StaticPairFact
|
||||
type Mode = <SP::FB as ParseMode>::Mode;
|
||||
}
|
||||
|
||||
impl<'a, Ctx: Context<'a>, SP: StaticPair<'a, Ctx>> StaticPairFactory<'a, Ctx, SP>
|
||||
where
|
||||
SP::FB: FactoryModeParse<'a, Ctx>,
|
||||
{
|
||||
pub fn mdeserialize_sp<I: InCtx<'a, Ctx>>(
|
||||
factory_data: &SP::FactoryData,
|
||||
inctx: I,
|
||||
) -> ModeResultM<'a, Ctx, Self, I> {
|
||||
let (fa, fb) = SP::factories(factory_data);
|
||||
let (a, inctx) = fa
|
||||
.ideserialize(inctx)
|
||||
.map_err(|e| SP::from_error_a(factory_data, e))?;
|
||||
Self::bind(
|
||||
fb.mdeserialize(inctx)
|
||||
.map_err(|e| SP::from_error_b(factory_data, e))?,
|
||||
|b| SP::from_parsed(factory_data, a, b).map(|pair| StaticPairObject { pair }),
|
||||
)
|
||||
}
|
||||
}
|
||||
|
||||
impl<'a, Ctx: Context<'a>, SP: StaticPair<'a, Ctx>> FactoryModeParse<'a, Ctx>
|
||||
for StaticPairFactory<'a, Ctx, SP>
|
||||
where
|
||||
SP::FB: FactoryModeParse<'a, Ctx>,
|
||||
{
|
||||
fn mdeserialize<I: InCtx<'a, Ctx>>(&self, inctx: I) -> ModeResultM<'a, Ctx, Self, I> {
|
||||
let (fa, fb) = SP::factories(&self.factory_data);
|
||||
let (a, inctx) = fa
|
||||
.ideserialize(inctx)
|
||||
.map_err(|e| SP::from_error_a(&self.factory_data, e))?;
|
||||
Self::bind(
|
||||
fb.mdeserialize(inctx)
|
||||
.map_err(|e| SP::from_error_b(&self.factory_data, e))?,
|
||||
|b| SP::from_parsed(&self.factory_data, a, b).map(|pair| StaticPairObject { pair }),
|
||||
)
|
||||
Self::mdeserialize_sp(&self.factory_data, inctx)
|
||||
}
|
||||
|
||||
fn mextend(
|
||||
|
Loading…
Reference in New Issue
Block a user