From 2e73ca8c5086a56a1504c1aacff6c4d4e8b76e39 Mon Sep 17 00:00:00 2001 From: timofey Date: Sat, 29 Jul 2023 09:36:13 +0000 Subject: [PATCH] `StackCompatibleProxy::T` --- src/rstd/collections/stack.rs | 22 ++++++++++++++-------- 1 file changed, 14 insertions(+), 8 deletions(-) diff --git a/src/rstd/collections/stack.rs b/src/rstd/collections/stack.rs index 7d1be93..5169828 100644 --- a/src/rstd/collections/stack.rs +++ b/src/rstd/collections/stack.rs @@ -39,28 +39,32 @@ pub trait StackCompatible<'a, Ctx: Context<'a>>: Mentionable<'a, Ctx> { fn points_typed_rest(stack: &Stack<'a, Ctx, Self>, points: &mut impl PointsVisitor<'a, Ctx>); } -pub trait StackCompatibleProxy<'a, Ctx: Context<'a>, T>: FactoryProxy<'a, Ctx> +pub trait StackCompatibleProxy<'a, Ctx: Context<'a>>: FactoryProxy<'a, Ctx> where Self::F: Factory<'a, Ctx>, { - fn points_typed_rest(stack: &T, points: &mut impl PointsVisitor<'a, Ctx>); + type T; + + fn points_typed_rest(stack: &Self::T, points: &mut impl PointsVisitor<'a, Ctx>); } impl<'a, Ctx: Context<'a>, A: Mentionable<'a, Ctx>> StackCompatible<'a, Ctx> for A where as WithParseMode>::WithMode: - StackCompatibleProxy<'a, Ctx, Stack<'a, Ctx, A>, F = Fctr<'a, Ctx, A>>, + StackCompatibleProxy<'a, Ctx, T = Stack<'a, Ctx, A>, F = Fctr<'a, Ctx, A>>, { fn points_typed_rest(stack: &Stack<'a, Ctx, Self>, points: &mut impl PointsVisitor<'a, Ctx>) { - < as WithParseMode>::WithMode as StackCompatibleProxy<'a, Ctx, _>>::points_typed_rest(stack, points) + < as WithParseMode>::WithMode as StackCompatibleProxy<'a, Ctx>>::points_typed_rest(stack, points) } } -impl<'a, Ctx: Context<'a>, F: RegularFactory<'a, Ctx>> - StackCompatibleProxy<'a, Ctx, Stack<'a, Ctx, Mtbl<'a, Ctx, F>>> for WithMode +impl<'a, Ctx: Context<'a>, F: RegularFactory<'a, Ctx>> StackCompatibleProxy<'a, Ctx> + for WithMode where F::Mtbl: MentionableTop<'a, Ctx>, { + type T = Stack<'a, Ctx, Mtbl<'a, Ctx, F>>; + fn points_typed_rest( stack: &Stack<'a, Ctx, Mtbl<'a, Ctx, Self::F>>, points: &mut impl PointsVisitor<'a, Ctx>, @@ -69,11 +73,13 @@ where } } -impl<'a, Ctx: Context<'a>, F: InlineableFactory<'a, Ctx>> - StackCompatibleProxy<'a, Ctx, Stack<'a, Ctx, Mtbl<'a, Ctx, F>>> for WithMode +impl<'a, Ctx: Context<'a>, F: InlineableFactory<'a, Ctx>> StackCompatibleProxy<'a, Ctx> + for WithMode where F::Mtbl: MentionableTop<'a, Ctx>, { + type T = Stack<'a, Ctx, Mtbl<'a, Ctx, F>>; + fn points_typed_rest( stack: &Stack<'a, Ctx, Mtbl<'a, Ctx, Self::F>>, points: &mut impl PointsVisitor<'a, Ctx>,