Diffstat (limited to 'src/protocol/visitor/request_hint.rs')
| -rw-r--r-- | src/protocol/visitor/request_hint.rs | 35 |
1 files changed, 16 insertions, 19 deletions
diff --git a/src/protocol/visitor/request_hint.rs b/src/protocol/visitor/request_hint.rs index 8b4f573..831594f 100644 --- a/src/protocol/visitor/request_hint.rs +++ b/src/protocol/visitor/request_hint.rs @@ -1,8 +1,5 @@ use crate::{ - any::{TypeName, WithContextLt}, - bijective_higher_ranked_type, - effect::{Effect, Future}, - protocol::{Visitor, Walker}, + any::{TypeName}, effect::{Effect, Future}, higher_ranked_type, hkt::Marker, protocol::{Visitor, Walker} }; use super::VisitResult; @@ -19,21 +16,21 @@ pub trait RequestHint<'ctx, E: Effect> { ) -> Future<'a, VisitResult<Walker<'a, 'ctx>>, E>; } -bijective_higher_ranked_type! { - pub type DynRequestHint['ctx][E]: WithContextLt['ctx][] - for<'a> - (dyn RequestHint<'ctx, E> + Send + 'a) - where { - E: Effect - } -} +pub struct RequestHintProto<E: Effect>(Marker<E>); + +higher_ranked_type! { + impl TypeName { + impl['a, 'ctx, E] type T['a, 'ctx] for RequestHintProto<E> = + dyn RequestHint<'ctx, E> + Send + 'a + where { + E: Effect + }; -bijective_higher_ranked_type! { - pub type [][E]: TypeName[][] - for<'ctx> - (DynRequestHint<'ctx, E>) - where { - E: Effect + impl['a, 'ctx, E] type HigherRanked['a, 'ctx] for dyn RequestHint<'ctx, E> + Send + 'a = + RequestHintProto<E> + where { + E: Effect + }; } } @@ -48,7 +45,7 @@ pub fn visit_request_hint<'a, 'ctx, E: Effect>( visitor: Visitor<'a, 'ctx>, walker: Walker<'a, 'ctx>, ) -> Future<'a, VisitResult<Walker<'a, 'ctx>>, E> { - if let Some(object) = visitor.upcast_mut::<DynRequestHint<'ctx, E>>() { + if let Some(object) = visitor.upcast_mut::<RequestHintProto<E>>() { // Allow the visitor to give a hint if it wants. object.request_hint(walker) } else { |