impl FactoryModeProxy

This commit is contained in:
AF 2023-07-29 19:20:05 +00:00
parent e655d40ecd
commit 4a9c2c0c3b
3 changed files with 34 additions and 1 deletions

View File

@ -33,7 +33,8 @@ pub use self::hashing::{Hash, HASH_SIZE, HASH_ZEROS};
pub use self::inctx::InCtx;
pub use self::inlining::{Inlining, InliningExt, InliningResultExt};
pub use self::modes::{
FactoryProxy, Mode, ParseMode, RegularFactory, RegularMode, WithMode, WithParseMode,
ExtensionResultM, FactoryModeParse, FactoryModeProxy, FactoryProxy, Mode, ParseMode,
ParseResultM, RegularFactory, RegularMode, WithMode, WithParseMode,
};
pub use self::origin::{OFctr, Origin};
pub use self::point::Point;

View File

@ -175,3 +175,17 @@ impl<'a, Ctx: Context<'a>, F: RegularFactory<'a, Ctx>> FactoryProxy<'a, Ctx>
f.rextend(mentionable, tail)
}
}
impl<'a, Ctx: Context<'a>, F: RegularFactory<'a, Ctx>> FactoryModeProxy<'a, Ctx>
for WithMode<F, RegularMode>
{
type F = F;
fn pmdeserialize<I: InCtx<'a, Ctx>>(f: &Self::F, inctx: I) -> ParseResultM<'a, Ctx, F, I> {
f.rdeserialize(inctx)
}
fn pmextend(f: &F, mentionable: Mtbl<'a, Ctx, F>, tail: &[u8]) -> ExtensionResultM<'a, Ctx, F> {
f.rextend(mentionable, tail)
}
}

View File

@ -60,6 +60,24 @@ impl<'a, Ctx: Context<'a>, F: InlineableFactory<'a, Ctx>> FactoryProxy<'a, Ctx>
}
}
impl<'a, Ctx: Context<'a>, F: InlineableFactory<'a, Ctx>> FactoryModeProxy<'a, Ctx>
for WithMode<F, InliningMode>
{
type F = F;
fn pmdeserialize<I: InCtx<'a, Ctx>>(f: &Self::F, inctx: I) -> ParseResultM<'a, Ctx, F, I> {
f.ideserialize(inctx)
}
fn pmextend(
f: &F,
_mentionable: Mtbl<'a, Ctx, F>,
tail: &[u8],
) -> ExtensionResultM<'a, Ctx, F> {
f.extension_error(tail)
}
}
impl<A: InlineableAtomic> AtomicProxy for WithMode<A, InliningMode> {
type A = A;