ParseFactory -> FactoryParse

This commit is contained in:
AF 2023-07-29 14:37:19 +00:00
parent 2678ef956b
commit 510f22efd2
5 changed files with 9 additions and 9 deletions

View File

@ -101,7 +101,7 @@ pub trait FactoryBase<'a, Ctx: Context<'a>>: 'a + Send + Sync + Clone {
type ParseError: 'a + Error; type ParseError: 'a + Error;
} }
pub trait ParseFactory<'a, Ctx: Context<'a>>: FactoryBase<'a, Ctx> { pub trait FactoryParse<'a, Ctx: Context<'a>>: FactoryBase<'a, Ctx> {
/// See [`Deserializer`], [`Resolver`]. /// See [`Deserializer`], [`Resolver`].
fn deserialize(&self, inctx: impl InCtx<'a, Ctx>) -> ParseResult<'a, Ctx, Self>; fn deserialize(&self, inctx: impl InCtx<'a, Ctx>) -> ParseResult<'a, Ctx, Self>;
/// Called by finite stream parsers if there's any data left. /// Called by finite stream parsers if there's any data left.
@ -111,7 +111,7 @@ pub trait ParseFactory<'a, Ctx: Context<'a>>: FactoryBase<'a, Ctx> {
/// Trait representing deserialisation rules for [Mentionable]s. /// Trait representing deserialisation rules for [Mentionable]s.
/// Crucial for [`crate::rstd::typeless`]. /// Crucial for [`crate::rstd::typeless`].
pub trait Factory<'a, Ctx: Context<'a>>: pub trait Factory<'a, Ctx: Context<'a>>:
ParseFactory<'a, Ctx, Mtbl = Self::_Mtbl> + ParseMode FactoryParse<'a, Ctx, Mtbl = Self::_Mtbl> + ParseMode
{ {
type _Mtbl: MentionableBase<'a, Ctx, Fctr = Self> + MentionableTop<'a, Ctx>; type _Mtbl: MentionableBase<'a, Ctx, Fctr = Self> + MentionableTop<'a, Ctx>;
} }

View File

@ -55,7 +55,7 @@ pub(super) trait InliningAddresses<E>: Inlining {
impl<E, D: ?Sized + Inlining> InliningAddresses<E> for D {} impl<E, D: ?Sized + Inlining> InliningAddresses<E> for D {}
fn _parse_slice<'a, Ctx: Context<'a>, F: ParseFactory<'a, Ctx>>( fn _parse_slice<'a, Ctx: Context<'a>, F: FactoryParse<'a, Ctx>>(
factory: &F, factory: &F,
slice: &[u8], slice: &[u8],
resolver: &Rc<dyn Resolver<'a, Ctx>>, resolver: &Rc<dyn Resolver<'a, Ctx>>,
@ -74,7 +74,7 @@ fn _parse_slice<'a, Ctx: Context<'a>, F: ParseFactory<'a, Ctx>>(
} }
} }
impl<'a, Ctx: Context<'a>, F: ParseFactory<'a, Ctx>> FactoryExt<'a, Ctx> for F { impl<'a, Ctx: Context<'a>, F: FactoryParse<'a, Ctx>> FactoryExt<'a, Ctx> for F {
fn parse_slice( fn parse_slice(
&self, &self,
slice: &[u8], slice: &[u8],

View File

@ -27,7 +27,7 @@ pub trait FactoryProxy<'a, Ctx: Context<'a>> {
) -> ParseResult<'a, Ctx, Self::F>; ) -> ParseResult<'a, Ctx, Self::F>;
} }
impl<'a, Ctx: Context<'a>, F: FactoryBase<'a, Ctx> + WithParseMode> ParseFactory<'a, Ctx> for F impl<'a, Ctx: Context<'a>, F: FactoryBase<'a, Ctx> + WithParseMode> FactoryParse<'a, Ctx> for F
where where
F::WithMode: FactoryProxy<'a, Ctx, F = Self>, F::WithMode: FactoryProxy<'a, Ctx, F = Self>,
{ {
@ -40,7 +40,7 @@ where
} }
} }
impl<'a, Ctx: Context<'a>, F: ParseFactory<'a, Ctx> + WithParseMode> Factory<'a, Ctx> for F impl<'a, Ctx: Context<'a>, F: FactoryParse<'a, Ctx> + WithParseMode> Factory<'a, Ctx> for F
where where
F::Mtbl: MentionableTop<'a, Ctx>, F::Mtbl: MentionableTop<'a, Ctx>,
{ {

View File

@ -9,7 +9,7 @@ pub trait Origin<'a, Ctx: Context<'a>>: 'a {
/// Try resolving the value. /// Try resolving the value.
fn resolve(self: Rc<Self>) -> Resolution<'a, Ctx, Self::Mtbl> fn resolve(self: Rc<Self>) -> Resolution<'a, Ctx, Self::Mtbl>
where where
OFctr<'a, Ctx, Self>: ParseFactory<'a, Ctx>; OFctr<'a, Ctx, Self>: FactoryParse<'a, Ctx>;
/// Try resolving the bytes. Should avoid parsing the value. /// Try resolving the bytes. Should avoid parsing the value.
fn resolve_bytes(self: Rc<Self>) -> HashResolution<'a, Ctx>; fn resolve_bytes(self: Rc<Self>) -> HashResolution<'a, Ctx>;
} }

View File

@ -27,7 +27,7 @@ struct ResolverOrigin<'a, Ctx: Context<'a>, F: FactoryBase<'a, Ctx>> {
r_resolver: Rc<dyn Resolver<'a, Ctx>>, r_resolver: Rc<dyn Resolver<'a, Ctx>>,
} }
fn _resolve_origin<'a, Ctx: Context<'a>, F: ParseFactory<'a, Ctx>>( fn _resolve_origin<'a, Ctx: Context<'a>, F: FactoryParse<'a, Ctx>>(
origin: Rc<ResolverOrigin<'a, Ctx, F>>, origin: Rc<ResolverOrigin<'a, Ctx, F>>,
) -> Resolution<'a, Ctx, F::Mtbl> { ) -> Resolution<'a, Ctx, F::Mtbl> {
origin origin
@ -52,7 +52,7 @@ impl<'a, Ctx: Context<'a>, F: FactoryBase<'a, Ctx>> Origin<'a, Ctx> for Resolver
fn resolve(self: Rc<Self>) -> Resolution<'a, Ctx, Self::Mtbl> fn resolve(self: Rc<Self>) -> Resolution<'a, Ctx, Self::Mtbl>
where where
F: ParseFactory<'a, Ctx>, F: FactoryParse<'a, Ctx>,
{ {
_resolve_origin(self) _resolve_origin(self)
} }