Diffstat (limited to 'src/protocol/visitor/request_hint.rs')
| -rw-r--r-- | src/protocol/visitor/request_hint.rs | 40 |
1 files changed, 21 insertions, 19 deletions
diff --git a/src/protocol/visitor/request_hint.rs b/src/protocol/visitor/request_hint.rs index ae2fcbf..f78dd23 100644 --- a/src/protocol/visitor/request_hint.rs +++ b/src/protocol/visitor/request_hint.rs @@ -1,13 +1,11 @@ use effectful::{ effective::Effective, environment::{DynBind, Environment, NativeForm}, - for_lt, - higher_ranked::Mut, SendSync, }; use crate::{ - any::TypeName, + any::type_name, hkt::Marker, protocol::{DynVisitor, DynWalker}, }; @@ -28,23 +26,23 @@ pub trait RequestHint<'ctx, E: Environment>: DynBind<E> { 'ctx: 'this + 'walker; } -#[derive(SendSync)] -pub struct RequestHintProto<E: Environment>(Marker<E>); +const _: () = { + pub struct RequestHintProto<E: Environment>(Marker<E>); -impl<'a, 'ctx, E> TypeName::MemberTypeForLt<'a, 'ctx, E, &'a &'ctx ()> for RequestHintProto<E> -where - E: Environment, -{ - type T = dyn RequestHint<'ctx, E> + 'a; -} + impl<'a, 'ctx, E> type_name::Lower<'a, 'ctx, &'a &'ctx ()> for RequestHintProto<E> + where + E: Environment, + { + type Lowered = dyn RequestHint<'ctx, E> + 'a; + } -impl<'a, 'ctx, E> TypeName::LowerTypeWithBound<'a, 'ctx, E, &'a &'ctx ()> - for dyn RequestHint<'ctx, E> + 'a -where - E: Environment, -{ - type Higher = RequestHintProto<E>; -} + impl<'a, 'ctx, E> type_name::Raise<'a, 'ctx, &'a &'ctx ()> for dyn RequestHint<'ctx, E> + 'a + where + E: Environment, + { + type Raised = RequestHintProto<E>; + } +}; /// Visit using the [`RequestHint`] protocol. /// @@ -59,7 +57,11 @@ pub fn request_hint<'ctx: 'visitor + 'walker, 'visitor: 'e, 'walker: 'e, 'e, E: ) -> NativeForm<'e, VisitResult<DynWalker<'walker, 'ctx, E>>, E> { E::value((visitor, walker)) .update((), |_, (visitor, walker)| { - if let Some(object) = visitor.0.upcast_mut::<RequestHintProto<E>>() { + if let Some(object) = visitor + .0 + .cast_mut() + .upcast_mut::<dyn RequestHint<'ctx, E>>() + { // Allow the visitor to give a hint if it wants. object .request_hint(walker.cast()) |