Diffstat (limited to 'src/protocol/visitor/value.rs')
| -rw-r--r-- | src/protocol/visitor/value.rs | 18 |
1 files changed, 10 insertions, 8 deletions
diff --git a/src/protocol/visitor/value.rs b/src/protocol/visitor/value.rs index 5a6e7c2..6efd1c5 100644 --- a/src/protocol/visitor/value.rs +++ b/src/protocol/visitor/value.rs @@ -3,7 +3,7 @@ //! In some sense, this is the most basic protocol. use effectful::{ - bound::{Bool, IsSend, IsSync}, + bound::{Bool, IsSend, IsSync, Dynamic}, effective::Effective, environment::{DynBind, EnvConfig, Environment, NativeForm}, SendSync, }; @@ -35,8 +35,9 @@ pub trait Value<'ctx, T: ?Sized + TypeName::MemberType<E>, E: Environment>: DynB fn visit<'a>( &'a mut self, value: TypeName::T<'a, 'ctx, T, E>, - ) -> NativeForm<'a, VisitResult<TypeName::T<'a, 'ctx, T, E>>, E> + ) -> NativeForm<'a, VisitResult<Dynamic<TypeName::T<'a, 'ctx, T, E>>>, E> where + Dynamic<TypeName::T<'a, 'ctx, T, E>>: DynBind<E>, TypeName::T<'a, 'ctx, T, E>: Sized, 'ctx: 'a; } @@ -67,7 +68,7 @@ pub struct ValueKnown<'a, T: ?Sized> { /// A preview of the value. /// /// This can be used to inspect the value before committing to a visit. - pub preview: Option<&'a T>, + pub preview: Option<Dynamic<&'a T>>, } #[derive(Copy, Clone, Debug, SendSync)] @@ -77,7 +78,7 @@ impl<'a, 'ctx, E: EnvConfig, T> Meta::MemberTypeForLt<'a, 'ctx, E, &'a &'ctx ()> for ValueKnownHrt<T> where T: ?Sized + TypeName::MemberTypeForLt<'a, 'ctx, E, &'a &'ctx ()>, - TypeName::T<'a, 'ctx, T, E>: IsSync<E::NeedSend>, + Dynamic<&'a TypeName::T<'a, 'ctx, T, E>>: DynBind<E>, { type T = ValueKnown<'a, TypeName::T<'a, 'ctx, T, E>>; } @@ -86,7 +87,7 @@ impl<'a, 'ctx, E: EnvConfig, T: ?Sized> Meta::LowerTypeWithBound<'a, 'ctx, E, &' for ValueKnown<'a, T> where T: TypeName::LowerType<'a, 'ctx, E>, - T: IsSync<E::NeedSend>, + Dynamic<&'a T>: DynBind<E>, { type Higher = ValueKnownHrt<TypeName::HigherRanked<'a, 'ctx, T, E>>; } @@ -94,7 +95,7 @@ where // This enrolls the Value protocol into the walker hint system. impl<T: TypeName::MemberType<E>, E: Environment> HintMeta for ValueProto<T, E> where - for<'a, 'ctx> TypeName::T<'a, 'ctx, T, E>: IsSync<E::NeedSend>, + for<'a, 'ctx> Dynamic<&'a TypeName::T<'a, 'ctx, T, E>>: DynBind<E>, { type Known = ValueKnownHrt<T>; @@ -112,9 +113,10 @@ pub fn visit_value< >( visitor: DynVisitor<'visitor, 'ctx, E>, value: T, -) -> NativeForm<'e, VisitResult<T>, E> +) -> NativeForm<'e, VisitResult<Dynamic<T>>, E> where TypeName::HigherRanked<'e, 'ctx, T, E>: TypeName::MemberType<E>, + Dynamic<T>: DynBind<E> { if let Some(object) = visitor .0 @@ -124,7 +126,7 @@ where object.visit(value) } else { // If the visitor doesn't support request hint then we continue. - E::value(VisitResult::Skipped(value)).cast() + E::value(VisitResult::Skipped(Dynamic(value))).cast() } } |