Diffstat (limited to 'src/walk/walkers/core/struct.rs')
| -rw-r--r-- | src/walk/walkers/core/struct.rs | 55 |
1 files changed, 32 insertions, 23 deletions
diff --git a/src/walk/walkers/core/struct.rs b/src/walk/walkers/core/struct.rs index e6138fb..f20ab0d 100644 --- a/src/walk/walkers/core/struct.rs +++ b/src/walk/walkers/core/struct.rs @@ -13,7 +13,7 @@ use crate::{ SequenceKnown, SequenceProto, SequenceScope, Tag, TagConst, TagDyn, TagError, TagKnown, TagProto, Value, ValueKnown, ValueProto, VisitResult, }, - walker::hint::{Hint, HintMeta, HintProto, MetaHint, MetaKnown}, + walker::hint::{DynVisitorWith, Hint, HintMeta, HintProto, MetaHint, MetaKnown}, DynVisitor, DynWalker, }, DynWalkerAdapter, Flow, Status, TAG_FIELD_NAMES, TAG_MAP, TAG_STRUCT, TAG_TYPE_ID, @@ -186,9 +186,9 @@ where #[inline(always)] fn hint<'this, 'visitor, 'hint, 'e>( &'this mut self, - _visitor: &'visitor mut (dyn Recoverable<'ctx, E> + Send + Sync), + _visitor: DynVisitorWith<'visitor, 'ctx, RecoverableProto<E>>, _hint: MetaHint<'hint, 'ctx, RecoverableProto<E>>, - ) -> ErasedEffective<'e, Flow, E> + ) -> ErasedEffective<'e, VisitResult, E> where 'ctx: 'this + 'visitor + 'hint + 'e, { @@ -220,9 +220,13 @@ where #[inline(always)] fn hint<'this, 'visitor, 'hint, 'e>( &'this mut self, - _visitor: &'visitor mut (dyn Tag<'ctx, tags::FieldNames, E> + Send + Sync), + _visitor: DynVisitorWith< + 'visitor, + 'ctx, + TagProto<TagConst<{ TAG_FIELD_NAMES.to_int() }>, E>, + >, _hint: MetaHint<'hint, 'ctx, TagProto<TagConst<{ TAG_FIELD_NAMES.to_int() }>, E>>, - ) -> ErasedEffective<'e, Flow, E> + ) -> ErasedEffective<'e, VisitResult, E> where 'ctx: 'this + 'visitor + 'hint + 'e, { @@ -268,9 +272,9 @@ where #[inline(always)] fn hint<'this, 'visitor, 'hint, 'e>( &'this mut self, - _visitor: &'visitor mut (dyn Tag<'ctx, tags::TypeName, E> + Send + Sync), + _visitor: DynVisitorWith<'visitor, 'ctx, TagProto<TagConst<{ TAG_TYPE_NAME.to_int() }>, E>>, _hint: MetaHint<'hint, 'ctx, TagProto<TagConst<{ TAG_TYPE_NAME.to_int() }>, E>>, - ) -> ErasedEffective<'e, Flow, E> + ) -> ErasedEffective<'e, VisitResult, E> where 'ctx: 'this + 'visitor + 'hint + 'e, { @@ -316,9 +320,9 @@ where #[inline(always)] fn hint<'this, 'visitor, 'hint, 'e>( &'this mut self, - _visitor: &'visitor mut (dyn Tag<'ctx, tags::Map, E> + Send + Sync), + _visitor: DynVisitorWith<'visitor, 'ctx, TagProto<TagConst<{ TAG_MAP.to_int() }>, E>>, _hint: MetaHint<'hint, 'ctx, TagProto<TagConst<{ TAG_MAP.to_int() }>, E>>, - ) -> ErasedEffective<'e, Flow, E> + ) -> ErasedEffective<'e, VisitResult, E> where 'ctx: 'this + 'visitor + 'hint + 'e, { @@ -360,9 +364,9 @@ where #[inline(always)] fn hint<'this: 'e, 'visitor: 'e, 'hint: 'e, 'e>( &'this mut self, - visitor: &'visitor mut (dyn Tag<'ctx, tags::Struct, E> + Send + Sync), + visitor: DynVisitorWith<'visitor, 'ctx, TagProto<TagConst<{ TAG_STRUCT.to_int() }>, E>>, _hint: MetaHint<'hint, 'ctx, TagProto<TagConst<{ TAG_STRUCT.to_int() }>, E>>, - ) -> ErasedEffective<'e, Flow, E> + ) -> ErasedEffective<'e, VisitResult, E> where 'ctx: 'this + 'visitor + 'hint + 'e, { @@ -371,8 +375,9 @@ where #[inline(always)] |(visitor, noop_walker)| { visitor + .as_known() .visit(TagConst, noop_walker) - .map(|status| status.to_flow().unwrap_or(Flow::Continue)) + .map(|status| VisitResult::Control(status.to_flow().unwrap_or(Flow::Continue))) .cast() }, ) @@ -404,9 +409,9 @@ where #[inline(always)] fn hint<'this, 'visitor, 'hint, 'e>( &'this mut self, - _visitor: &'visitor mut (dyn Tag<'ctx, tags::TypeId, E> + Send + Sync), + _visitor: DynVisitorWith<'visitor, 'ctx, TagProto<TagConst<{ TAG_TYPE_ID.to_int() }>, E>>, _hint: MetaHint<'hint, 'ctx, TagProto<TagConst<{ TAG_TYPE_ID.to_int() }>, E>>, - ) -> ErasedEffective<'e, Flow, E> + ) -> ErasedEffective<'e, VisitResult, E> where 'ctx: 'this + 'visitor + 'hint + 'e, { @@ -452,9 +457,9 @@ where #[inline(always)] fn hint<'this: 'e, 'visitor: 'e, 'hint: 'e, 'e>( &'this mut self, - _visitor: &'visitor mut (dyn Tag<'ctx, TagDyn, E> + Send + Sync), + _visitor: DynVisitorWith<'visitor, 'ctx, TagProto<TagDyn, E>>, _hint: MetaHint<'hint, 'ctx, TagProto<TagDyn, E>>, - ) -> ErasedEffective<'e, Flow, E> + ) -> ErasedEffective<'e, VisitResult, E> where 'ctx: 'this + 'visitor + 'hint + 'e, { @@ -520,9 +525,9 @@ where #[inline(always)] fn hint<'this, 'visitor, 'hint, 'e>( &'this mut self, - _visitor: &'visitor mut (dyn Value<'ctx, BorrowedStaticHrt<I::T>, E> + Send + Sync), + _visitor: DynVisitorWith<'visitor, 'ctx, ValueProto<BorrowedStaticHrt<I::T>, E>>, _hint: MetaHint<'hint, 'ctx, ValueProto<BorrowedStaticHrt<I::T>, E>>, - ) -> ErasedEffective<'e, Flow, E> + ) -> ErasedEffective<'e, VisitResult, E> where 'ctx: 'this + 'visitor + 'hint + 'e, { @@ -554,18 +559,22 @@ where fn hint<'this: 'e, 'visitor: 'e, 'hint: 'e, 'e>( &'this mut self, - visitor: &'visitor mut (dyn Sequence<'ctx, E> + Send + Sync), + visitor: DynVisitorWith<'visitor, 'ctx, SequenceProto<E>>, _hint: MetaHint<'hint, 'ctx, SequenceProto<E>>, - ) -> ErasedEffective<'e, Flow, E> + ) -> ErasedEffective<'e, VisitResult, E> where 'ctx: 'this + 'visitor + 'hint + 'e, { E::as_ctx_map((self, visitor), |(this, visitor)| { visitor + .as_known() .visit(*this) - .map(|status| match status { - VisitResult::Skipped(_) => Flow::Continue, - VisitResult::Control(flow) => flow, + .map(|status| { + match status { + VisitResult::Skipped(_) => Flow::Continue, + VisitResult::Control(flow) => flow, + } + .into() }) .cast() }) |