From eaa83b1bf006cf87349a1f1a0162adfc9a1e1269 Mon Sep 17 00:00:00 2001 From: timofey Date: Sat, 5 Aug 2023 13:22:02 +0000 Subject: [PATCH] `MentionableTop` for tuple --- src/rstd/collections/pair.rs | 12 ++++++++++-- src/rstd/inlining/static_pair.rs | 4 +++- 2 files changed, 13 insertions(+), 3 deletions(-) diff --git a/src/rstd/collections/pair.rs b/src/rstd/collections/pair.rs index 5be8330..8bbde67 100644 --- a/src/rstd/collections/pair.rs +++ b/src/rstd/collections/pair.rs @@ -48,7 +48,7 @@ impl Error for PairParseError {} impl<'a, Ctx: Context<'a>, A: MentionableBase<'a, Ctx>, B: MentionableBase<'a, Ctx>> StaticPair<'a, Ctx> for (A, B) where - A::Fctr: InliningFactory<'a, Ctx>, + A::Fctr: ParseMode, B::Fctr: ParseMode, { type FactoryData = (Self::FA, Self::FB); @@ -136,7 +136,7 @@ impl AtomicBase for (A, B) { type AParseError = PairParseError; } -impl, B: ParseMode> ParseMode for (A, B) { +impl ParseMode for (A, B) { type Mode = B::Mode; } @@ -164,3 +164,11 @@ impl<'a, Ctx: Context<'a>, FA: InliningFactory<'a, Ctx>, FB: FactoryModeParse<'a PFImpl::<'a, Ctx, FA, FB>::mextend_sp(self, mentionable, tail) } } + +impl<'a, Ctx: Context<'a>, A: Mentionable<'a, Ctx>, B: Mentionable<'a, Ctx>> MentionableTop<'a, Ctx> + for (A, B) +{ + fn points_typed(&self, points: &mut impl PointsVisitor<'a, Ctx>) { + StaticPairObject::::points_typed_sp(self, points) + } +} diff --git a/src/rstd/inlining/static_pair.rs b/src/rstd/inlining/static_pair.rs index 1509a8d..f28f755 100644 --- a/src/rstd/inlining/static_pair.rs +++ b/src/rstd/inlining/static_pair.rs @@ -39,7 +39,7 @@ pub trait StaticPair<'a, Ctx: Context<'a>>: /// Second element's type. Must equal [`StaticPairSerializable::SB`]. type B: MentionableBase<'a, Ctx, Fctr = Self::FB>; /// First element's factory. - type FA: FactoryBase<'a, Ctx, Mtbl = Self::A> + InliningFactory<'a, Ctx>; + type FA: FactoryBase<'a, Ctx, Mtbl = Self::A> + ParseMode; /// Second element's factory. type FB: FactoryBase<'a, Ctx, Mtbl = Self::B> + ParseMode; /// See [`FactoryBase::ParseError`]. @@ -171,6 +171,7 @@ impl<'a, Ctx: Context<'a>, SP: StaticPair<'a, Ctx>> ParseMode for StaticPairFact impl<'a, Ctx: Context<'a>, SP: StaticPair<'a, Ctx>> StaticPairFactory<'a, Ctx, SP> where + SP::FA: InliningFactory<'a, Ctx>, SP::FB: FactoryModeParse<'a, Ctx>, { pub fn mdeserialize_sp>( @@ -207,6 +208,7 @@ where impl<'a, Ctx: Context<'a>, SP: StaticPair<'a, Ctx>> FactoryModeParse<'a, Ctx> for StaticPairFactory<'a, Ctx, SP> where + SP::FA: InliningFactory<'a, Ctx>, SP::FB: FactoryModeParse<'a, Ctx>, { fn mdeserialize>(&self, inctx: I) -> ModeResultM<'a, Ctx, Self, I> {