mprepare
This commit is contained in:
parent
78e74fbf35
commit
bd62ae8dbb
@ -54,7 +54,7 @@ impl<'a, Ctx: Context<'a>, F: FactoryModeParse<'a, Ctx>> FactoryParse<'a, Ctx> f
|
||||
}
|
||||
|
||||
fn extend(&self, mentionable: Self::Mtbl, tail: &[u8]) -> ParseResult<'a, Ctx, Self> {
|
||||
<<Self as ParseMode>::Mode as Mode>::xseal(self.mextend(mentionable, tail))
|
||||
<<Self as ParseMode>::Mode as Mode>::xseal(self.mextend(Self::mprepare(mentionable), tail))
|
||||
}
|
||||
}
|
||||
|
||||
@ -76,7 +76,14 @@ pub type ExtensionSourceM<'a, Ctx, F> =
|
||||
|
||||
pub trait FactoryModeParse<'a, Ctx: Context<'a>>: FactoryBase<'a, Ctx> + ParseMode {
|
||||
fn mdeserialize<I: InCtx<'a, Ctx>>(&self, inctx: I) -> ParseResultM<'a, Ctx, Self, I>;
|
||||
fn mextend(&self, mentionable: Self::Mtbl, tail: &[u8]) -> ExtensionResultM<'a, Ctx, Self>;
|
||||
|
||||
fn mextend(
|
||||
&self,
|
||||
mentionable: ExtensionSourceM<'a, Ctx, Self>,
|
||||
tail: &[u8],
|
||||
) -> ExtensionResultM<'a, Ctx, Self>;
|
||||
|
||||
fn mprepare(mentionable: Self::Mtbl) -> ExtensionSourceM<'a, Ctx, Self>;
|
||||
}
|
||||
|
||||
pub trait FactoryModeProxy<'a, Ctx: Context<'a>> {
|
||||
@ -84,11 +91,14 @@ pub trait FactoryModeProxy<'a, Ctx: Context<'a>> {
|
||||
|
||||
fn pmdeserialize<I: InCtx<'a, Ctx>>(f: &Self::F, inctx: I)
|
||||
-> ParseResultM<'a, Ctx, Self::F, I>;
|
||||
|
||||
fn pmextend(
|
||||
f: &Self::F,
|
||||
mentionable: Mtbl<'a, Ctx, Self::F>,
|
||||
mentionable: ExtensionSourceM<'a, Ctx, Self::F>,
|
||||
tail: &[u8],
|
||||
) -> ExtensionResultM<'a, Ctx, Self::F>;
|
||||
|
||||
fn pmprepare(mentionable: Mtbl<'a, Ctx, Self::F>) -> ExtensionSourceM<'a, Ctx, Self::F>;
|
||||
}
|
||||
|
||||
impl<'a, Ctx: Context<'a>, F: FactoryBase<'a, Ctx> + WithParseMode> FactoryModeParse<'a, Ctx> for F
|
||||
@ -99,9 +109,17 @@ where
|
||||
<F::WithMode as FactoryModeProxy<'a, Ctx>>::pmdeserialize(self, inctx)
|
||||
}
|
||||
|
||||
fn mextend(&self, mentionable: Self::Mtbl, tail: &[u8]) -> ExtensionResultM<'a, Ctx, Self> {
|
||||
fn mextend(
|
||||
&self,
|
||||
mentionable: ExtensionSourceM<'a, Ctx, Self>,
|
||||
tail: &[u8],
|
||||
) -> ExtensionResultM<'a, Ctx, Self> {
|
||||
<F::WithMode as FactoryModeProxy<'a, Ctx>>::pmextend(self, mentionable, tail)
|
||||
}
|
||||
|
||||
fn mprepare(mentionable: Self::Mtbl) -> ExtensionSourceM<'a, Ctx, Self> {
|
||||
<F::WithMode as FactoryModeProxy<'a, Ctx>>::pmprepare(mentionable)
|
||||
}
|
||||
}
|
||||
|
||||
pub struct RegularMode;
|
||||
@ -169,4 +187,8 @@ impl<'a, Ctx: Context<'a>, F: RegularFactory<'a, Ctx>> FactoryModeProxy<'a, Ctx>
|
||||
fn pmextend(f: &F, mentionable: Mtbl<'a, Ctx, F>, tail: &[u8]) -> ExtensionResultM<'a, Ctx, F> {
|
||||
f.rextend(mentionable, tail)
|
||||
}
|
||||
|
||||
fn pmprepare(mentionable: Mtbl<'a, Ctx, Self::F>) -> ExtensionSourceM<'a, Ctx, Self::F> {
|
||||
mentionable
|
||||
}
|
||||
}
|
||||
|
@ -59,11 +59,13 @@ impl<'a, Ctx: Context<'a>, F: InlineableFactory<'a, Ctx>> FactoryModeProxy<'a, C
|
||||
|
||||
fn pmextend(
|
||||
f: &F,
|
||||
_mentionable: Mtbl<'a, Ctx, F>,
|
||||
_mentionable: ExtensionSourceM<'a, Ctx, F>,
|
||||
tail: &[u8],
|
||||
) -> ExtensionResultM<'a, Ctx, F> {
|
||||
f.extension_error(tail)
|
||||
}
|
||||
|
||||
fn pmprepare(_mentionable: Mtbl<'a, Ctx, Self::F>) -> ExtensionSourceM<'a, Ctx, Self::F> {}
|
||||
}
|
||||
|
||||
impl<A: InlineableAtomic> AtomicProxy for WithMode<A, InliningMode> {
|
||||
|
Loading…
Reference in New Issue
Block a user