Diffstat (limited to 'src/protocol/visitor/value.rs')
| -rw-r--r-- | src/protocol/visitor/value.rs | 32 |
1 files changed, 15 insertions, 17 deletions
diff --git a/src/protocol/visitor/value.rs b/src/protocol/visitor/value.rs index 3e9a3bc..1ed5682 100644 --- a/src/protocol/visitor/value.rs +++ b/src/protocol/visitor/value.rs @@ -17,7 +17,7 @@ use super::Status; /// Trait object for the [`Value`] protocol. /// /// Types implementing the [`Value`] protocol will implement this trait. -pub trait Value<'a, 'ctx: 'a, T, E: Effect<'ctx>> { +pub trait Value<'ctx, T, E: Effect<'ctx>> { /// Visit a value of type `T`. /// /// Use this to give a value to a visitor. Its expected that a walker @@ -27,24 +27,22 @@ pub trait Value<'a, 'ctx: 'a, T, E: Effect<'ctx>> { /// If a [`ControlFlow::Break`] is returned then the walker /// should stop walking as soon as possible as there has likely been /// and error. - fn visit(&'a mut self, value: T) -> Future<'a, 'ctx, Flow, E>; + fn visit<'a>(&'a mut self, value: T) -> Future<'a, 'ctx, Flow, E>; } -pub type DynValue<'a, 'ctx, T, E> = dyn Value<'a, 'ctx, T, E> + Send + 'a; +pub type DynValue<'a, 'ctx, T, E> = dyn Value<'ctx, T, E> + Send + 'a; nameable! { - pub struct Name['a, 'ctx, T, E]; + pub struct Name['ctx, T, E] for<'a>; impl [T::Name, E] for DynValue<'a, 'ctx, T, E> where { - T: TypeNameable<'a, 'ctx> + ?Sized, + T: TypeNameable<'ctx> + ?Sized, E: Effect<'ctx>, - 'ctx: 'a, } impl [T, E] where DynValue<'a, 'ctx, T::Nameable, E> { - T: TypeName<'a, 'ctx> + ?Sized, + T: TypeName<'ctx> + ?Sized, E: Effect<'ctx>, - 'ctx: 'a, } } @@ -59,7 +57,7 @@ impl<'a, 'ctx: 'a, T, E: Effect<'ctx>> HintMeta<'ctx> for DynValue<'a, 'ctx, T, type Hint = (); } -pub fn visit_value<'a, 'ctx, T: TypeNameable<'a, 'ctx>, E: Effect<'ctx>>( +pub fn visit_value<'a, 'ctx, T: TypeNameable<'ctx>, E: Effect<'ctx>>( visitor: Visitor<'a, 'ctx>, value: T, ) -> Future<'a, 'ctx, Status, E> { @@ -102,11 +100,11 @@ mod test { fn visit() { struct Visitor<E>(Option<i32>, PhantomData<fn() -> E>); - impl<'a, 'ctx: 'a, E> Value<'a, 'ctx, OwnedStatic<i32>, E> for Visitor<E> + impl<'ctx, E> Value<'ctx, OwnedStatic<i32>, E> for Visitor<E> where E: Effect<'ctx>, { - fn visit( + fn visit<'a>( &'a mut self, OwnedStatic(value): OwnedStatic<i32>, ) -> Future<'a, 'ctx, Flow, E> { @@ -117,11 +115,11 @@ mod test { } } - impl<'a, 'ctx: 'a, E> Value<'a, 'ctx, BorrowedStatic<'ctx, i32>, E> for Visitor<E> + impl<'ctx, E> Value<'ctx, BorrowedStatic<'ctx, i32>, E> for Visitor<E> where E: Effect<'ctx>, { - fn visit( + fn visit<'a>( &'a mut self, BorrowedStatic(value): BorrowedStatic<'ctx, i32>, ) -> Future<'a, 'ctx, Flow, E> { @@ -165,11 +163,11 @@ mod test { fn visit_borrowed() { struct Visitor<'ctx, E>(Option<&'ctx mut String>, PhantomData<fn() -> E>); - impl<'a, 'ctx: 'a, E> Value<'a, 'ctx, BorrowedMutStatic<'ctx, String>, E> for Visitor<'ctx, E> + impl<'ctx, E> Value<'ctx, BorrowedMutStatic<'ctx, String>, E> for Visitor<'ctx, E> where E: Effect<'ctx>, { - fn visit( + fn visit<'a>( &'a mut self, BorrowedMutStatic(value): BorrowedMutStatic<'ctx, String>, ) -> Future<'a, 'ctx, Flow, E> { @@ -206,11 +204,11 @@ mod test { fn visit_borrowed_unsized() { struct Visitor<'ctx, E>(Option<&'ctx str>, PhantomData<fn() -> E>); - impl<'a, 'ctx: 'a, E> Value<'a, 'ctx, BorrowedStatic<'ctx, str>, E> for Visitor<'ctx, E> + impl<'ctx, E> Value<'ctx, BorrowedStatic<'ctx, str>, E> for Visitor<'ctx, E> where E: Effect<'ctx>, { - fn visit( + fn visit<'a>( &'a mut self, BorrowedStatic(value): BorrowedStatic<'ctx, str>, ) -> Future<'a, 'ctx, Flow, E> { |