From 1536f38f0b1f64c03ea03eaf90f3dd811f4135e7 Mon Sep 17 00:00:00 2001 From: timofey Date: Sun, 30 Jul 2023 14:06:02 +0000 Subject: [PATCH] `ParseModeExt::seal` --- src/rcore/modes.rs | 7 +++++-- 1 file changed, 5 insertions(+), 2 deletions(-) diff --git a/src/rcore/modes.rs b/src/rcore/modes.rs index 87e4b8b..03b8fbc 100644 --- a/src/rcore/modes.rs +++ b/src/rcore/modes.rs @@ -112,6 +112,10 @@ pub trait ParseModeExt: ParseMode { ::map(s, f) } + fn seal(s: ::ParseSuccess) -> A { + ::seal(s) + } + fn smap( source: ::ExtensionSource, f: impl FnOnce(A0) -> A1, @@ -142,8 +146,7 @@ pub struct WithMode(PhantomData, T); impl<'a, Ctx: Context<'a>, F: FactoryModeParse<'a, Ctx>> FactoryParse<'a, Ctx> for F { fn deserialize(&self, inctx: impl InCtx<'a, Ctx>) -> ParseResult<'a, Ctx, Self> { - self.mdeserialize(inctx) - .map(<::Mode as Mode>::seal) + self.mdeserialize(inctx).map(Self::seal) } fn extend(&self, mentionable: Self::Mtbl, tail: &[u8]) -> ParseResult<'a, Ctx, Self> {