Diffstat (limited to 'src/walk/walkers/core/struct.rs')
| -rw-r--r-- | src/walk/walkers/core/struct.rs | 27 |
1 files changed, 12 insertions, 15 deletions
diff --git a/src/walk/walkers/core/struct.rs b/src/walk/walkers/core/struct.rs index 3150273..c4a9d49 100644 --- a/src/walk/walkers/core/struct.rs +++ b/src/walk/walkers/core/struct.rs @@ -3,8 +3,7 @@ use core::any::TypeId; use effectful::{ bound::{IsSend, IsSync}, effective::Effective, - environment::{DynBind, Environment, NativeForm}, - forward_send_sync, + environment::{DynBind, Environment, NativeForm}, SendSync, }; use crate::{ @@ -31,6 +30,7 @@ use super::{noop::NoopWalker, value::ValueWalker}; /// Walker for a borrow of a struct. /// /// This walker implements the struct flow. The struct cannot contain lifetimes. +#[derive(SendSync)] pub struct StructWalker<'ctx, I: StructTypeInfo<'ctx, M, E, S = S>, S, M, E: Environment> { /// Struct value to walk. value: &'ctx I::T, @@ -46,15 +46,6 @@ pub struct StructWalker<'ctx, I: StructTypeInfo<'ctx, M, E, S = S>, S, M, E: Env _generics: Marker<E>, } -unsafe impl<'ctx, I: StructTypeInfo<'ctx, M, E, S = S>, S, M, E: Environment> IsSend<E::NeedSend> - for StructWalker<'ctx, I, S, M, E> -{ -} -unsafe impl<'ctx, I: StructTypeInfo<'ctx, M, E, S = S>, S, M, E: Environment> IsSync<E::NeedSync> - for StructWalker<'ctx, I, S, M, E> -{ -} - /// Type info about a struct needed by [`StructWalker`]. pub trait StructTypeInfo<'ctx, M, E: Environment>: 'static { /// Name of the struct. @@ -79,7 +70,7 @@ pub trait StructTypeInfo<'ctx, M, E: Environment>: 'static { ) -> NativeForm<'a, Result<Flow, Self::FieldError>, E>; } -#[derive(Debug, PartialEq, Clone, Copy)] +#[derive(Debug, PartialEq, Clone, Copy, SendSync)] #[allow(unused)] enum StructWalkErrorKind<T> { /// Error with visiting a tag for the struct. @@ -97,14 +88,12 @@ enum StructWalkErrorKind<T> { } /// Error from walking a struct. -#[derive(Debug, PartialEq, Copy, Clone)] +#[derive(Debug, PartialEq, Copy, Clone, SendSync)] #[allow(unused)] pub struct StructWalkError<T> { kind: StructWalkErrorKind<T>, } -forward_send_sync!({T} {} StructWalkError<T>); - impl<'ctx, I, S, M, E: Environment> StructWalker<'ctx, I, S, M, E> where I: StructTypeInfo<'ctx, M, E, S = S>, @@ -229,6 +218,7 @@ where impl<'ctx, I, S, M, E> Hint<'ctx, TagProto<TagConst<{ TAG_FIELD_NAMES.to_int() }>, E>> for StructWalker<'ctx, I, S, M, E> where + Self: DynBind<E>, E: Environment, I: StructTypeInfo<'ctx, M, E, S = S>, { @@ -282,6 +272,7 @@ where impl<'ctx, I, S, M, E> Hint<'ctx, TagProto<TagConst<{ TAG_TYPE_NAME.to_int() }>, E>> for StructWalker<'ctx, I, S, M, E> where + Self: DynBind<E>, E: Environment, I: StructTypeInfo<'ctx, M, E, S = S>, { @@ -331,6 +322,7 @@ where impl<'ctx, I, S, M, E> Hint<'ctx, TagProto<TagConst<{ TAG_MAP.to_int() }>, E>> for StructWalker<'ctx, I, S, M, E> where + Self: DynBind<E>, E: Environment, I: StructTypeInfo<'ctx, M, E, S = S>, { @@ -376,6 +368,7 @@ where impl<'ctx, I, S, M, E> Hint<'ctx, TagProto<TagConst<{ TAG_STRUCT.to_int() }>, E>> for StructWalker<'ctx, I, S, M, E> where + Self: DynBind<E>, E: Environment, I: StructTypeInfo<'ctx, M, E, S = S>, { @@ -423,6 +416,7 @@ where impl<'ctx, I, M, E> Hint<'ctx, TagProto<TagConst<{ TAG_TYPE_ID.to_int() }>, E>> for StructWalker<'ctx, I, StaticType, M, E> where + Self: DynBind<E>, E: Environment, I: StructTypeInfo<'ctx, M, E, S = StaticType>, I::T: 'static, @@ -472,6 +466,7 @@ where impl<'ctx, I, M, E> Hint<'ctx, TagProto<TagDyn, E>> for StructWalker<'ctx, I, StaticType, M, E> where + Self: DynBind<E>, E: Environment, I: StructTypeInfo<'ctx, M, E, S = StaticType>, I::T: 'static, @@ -575,6 +570,7 @@ where impl<'ctx, I, S, M: 'ctx, E> Hint<'ctx, SequenceProto<E>> for StructWalker<'ctx, I, S, M, E> where + Self: DynBind<E>, E: Environment, I: StructTypeInfo<'ctx, M, E, S = S>, { @@ -621,6 +617,7 @@ where impl<'ctx, I, S, M: 'ctx, E> SequenceScope<'ctx, E> for StructWalker<'ctx, I, S, M, E> where + Self: DynBind<E>, E: Environment, I: StructTypeInfo<'ctx, M, E, S = S>, { |