type-neutral mdeserialize_sp
All checks were successful
buildbot/fmt-check Build done.
buildbot/runtests Build done.
buildbot/rustdoc Build done.
buildbot/clippy Build done.

This commit is contained in:
AF 2023-08-05 13:02:03 +00:00
parent c7d69b9982
commit 4adb021a14

View File

@ -176,7 +176,7 @@ where
pub fn mdeserialize_sp<I: InCtx<'a, Ctx>>( pub fn mdeserialize_sp<I: InCtx<'a, Ctx>>(
factory_data: &SP::FactoryData, factory_data: &SP::FactoryData,
inctx: I, inctx: I,
) -> ModeResultM<'a, Ctx, Self, I> { ) -> ModeResultP<Self, SP, <Self as FactoryBase<'a, Ctx>>::ParseError, I> {
let (fa, fb) = SP::factories(factory_data); let (fa, fb) = SP::factories(factory_data);
let (a, inctx) = fa let (a, inctx) = fa
.ideserialize(inctx) .ideserialize(inctx)
@ -184,7 +184,7 @@ where
Self::bind( Self::bind(
fb.mdeserialize(inctx) fb.mdeserialize(inctx)
.map_err(|e| SP::from_error_b(factory_data, e))?, .map_err(|e| SP::from_error_b(factory_data, e))?,
|b| SP::from_parsed(factory_data, a, b).map(|pair| StaticPairObject { pair }), |b| SP::from_parsed(factory_data, a, b),
) )
} }
} }
@ -195,7 +195,10 @@ where
SP::FB: FactoryModeParse<'a, Ctx>, SP::FB: FactoryModeParse<'a, Ctx>,
{ {
fn mdeserialize<I: InCtx<'a, Ctx>>(&self, inctx: I) -> ModeResultM<'a, Ctx, Self, I> { fn mdeserialize<I: InCtx<'a, Ctx>>(&self, inctx: I) -> ModeResultM<'a, Ctx, Self, I> {
Self::mdeserialize_sp(&self.factory_data, inctx) Ok(Self::map(
Self::mdeserialize_sp(&self.factory_data, inctx)?,
|pair| StaticPairObject { pair },
))
} }
fn mextend( fn mextend(