Diffstat (limited to 'src/protocol/visitor/request_hint.rs')
| -rw-r--r-- | src/protocol/visitor/request_hint.rs | 24 |
1 files changed, 17 insertions, 7 deletions
diff --git a/src/protocol/visitor/request_hint.rs b/src/protocol/visitor/request_hint.rs index 516dffa..aa5f8ee 100644 --- a/src/protocol/visitor/request_hint.rs +++ b/src/protocol/visitor/request_hint.rs @@ -1,6 +1,7 @@ use crate::{ + any::{MaybeSized, TypeName}, + bijective_higher_ranked_type, effect::{Effect, Future}, - nameable, protocol::{Visitor, Walker}, Flow, }; @@ -14,12 +15,21 @@ pub trait RequestHint<'ctx, E: Effect<'ctx>> { fn request_hint<'a>(&'a mut self, walker: Walker<'a, 'ctx>) -> Future<'a, 'ctx, Flow, E>; } -pub type DynRequestHint<'a, 'ctx, E> = dyn RequestHint<'ctx, E> + Send + 'a; +bijective_higher_ranked_type! { + pub type DynRequestHint['ctx][E]: MaybeSized['ctx][] + for<'a> + (dyn RequestHint<'ctx, E> + Send + 'a) + where { + E: Effect<'ctx> + } +} -nameable! { - pub struct Name['ctx, E] for <'a>; - impl [E] for DynRequestHint<'a, 'ctx, E> where { - E: Effect<'ctx>, +bijective_higher_ranked_type! { + pub type [][E]: TypeName[][] + for<'ctx> + (DynRequestHint<'ctx, E>) + where { + E: Effect<'ctx> } } @@ -34,7 +44,7 @@ pub fn visit_request_hint<'a, 'ctx, E: Effect<'ctx>>( visitor: Visitor<'a, 'ctx>, walker: Walker<'a, 'ctx>, ) -> Future<'a, 'ctx, Flow, E> { - if let Some(object) = visitor.upcast_mut::<DynRequestHint<'_, 'ctx, E>>() { + if let Some(object) = visitor.upcast_mut::<DynRequestHint<'ctx, E>>() { // Allow the visitor to give a hint if it wants. object.request_hint(walker) } else { |