Diffstat (limited to 'src/protocol/walker/hint.rs')
| -rw-r--r-- | src/protocol/walker/hint.rs | 29 |
1 files changed, 14 insertions, 15 deletions
diff --git a/src/protocol/walker/hint.rs b/src/protocol/walker/hint.rs index 28bf437..57eaa1a 100644 --- a/src/protocol/walker/hint.rs +++ b/src/protocol/walker/hint.rs @@ -13,37 +13,36 @@ use crate::{ /// Meta information for the hint. /// /// This gives the visitor more information to work from when selecting a hint. -pub trait HintMeta<'ctx> { +pub trait HintMeta<'a, 'ctx: 'a> { /// Information known by the walker. /// /// This should be information easy to get without changing the state of the walker /// in an irreversible way. - type Known<'a> - where - 'ctx: 'a; + type Known; /// Extra information the visitor can give to the walker about what it is expecting. - type Hint<'a> - where - 'ctx: 'a; + type Hint; } /// Object implementing the [`Hint`] protocol. -pub trait Hint<'ctx, Protocol: ?Sized + HintMeta<'ctx>, E: Effect = SyncEffect> { +pub trait Hint<'ctx, Protocol: ?Sized + for<'a> HintMeta<'a, 'ctx>, E = SyncEffect> +where + E: Effect<'ctx> + Effect<'ctx, <Protocol as HintMeta<'a, 'ctx>>::Known>, +{ /// Hint to the walker to use the `P` protocol. /// /// This should only be called once per [`RequestHint`]. fn hint<'a>( &'a mut self, - visitor: &'a mut Visitor<'a, 'ctx>, - hint: Protocol::Hint<'a>, - ) -> ControlFlowFor<'a, E>; + visitor: &'a mut Visitor<'a, 'ctx, E>, + hint: <Protocol as HintMeta<'a, 'ctx>>::Hint, + ) -> ControlFlowFor<'a, 'ctx, E>; /// Ask the walker for information about it's support of the protocol. fn known<'a>( &'a mut self, - hint: &'a Protocol::Hint<'a>, - ) -> ControlFlowFor<'a, E, Protocol::Known<'_>> + hint: &'a <Protocol as HintMeta<'a, 'ctx>>::Hint, + ) -> ControlFlowFor<'a, 'ctx, E, <Protocol as HintMeta<'a, 'ctx>>::Known> where 'ctx: 'a; } @@ -53,13 +52,13 @@ nameable! { impl [Protocol::Name, E] for dyn Hint<'ctx, Protocol, E> + 'a where { Protocol: TypeNameable<'a, 'ctx> + ?Sized, - E: Effect + 'static, + E: Effect<'ctx>, 'ctx: 'a, } impl [Protocol, E] where dyn Hint<'ctx, Protocol::Nameable, E> + 'a { Protocol: TypeName<'a, 'ctx> + ?Sized, - E: Effect + 'static, + E: Effect<'ctx>, 'ctx: 'a, } } |