Diffstat (limited to 'src/walk/walkers/core/struct.rs')
-rw-r--r--src/walk/walkers/core/struct.rs546
1 files changed, 289 insertions, 257 deletions
diff --git a/src/walk/walkers/core/struct.rs b/src/walk/walkers/core/struct.rs
index 9e301e8..81e6950 100644
--- a/src/walk/walkers/core/struct.rs
+++ b/src/walk/walkers/core/struct.rs
@@ -3,7 +3,7 @@ use core::any::TypeId;
use crate::{
any::{AnyTrait, BorrowedStatic, BorrowedStaticHrt},
any_trait,
- effect::{Effect, Future},
+ effect::{Effect, ObjSafe},
hkt::Marker,
never::Never,
protocol::{
@@ -65,7 +65,7 @@ pub trait StructTypeInfo<'ctx, M>: 'static {
index: usize,
value: &'ctx Self::T,
visitor: DynVisitor<'a, 'ctx>,
- ) -> Future<'a, Result<Flow, Self::FieldError>, E>;
+ ) -> ObjSafe<'a, Result<Flow, Self::FieldError>, E>;
}
#[derive(Debug, PartialEq, Clone, Copy)]
@@ -121,23 +121,25 @@ where
I: StructTypeInfo<'ctx, M, S = S>,
Self: AnyTrait<'ctx> + RecoverableScope<'ctx, E>,
{
+ #[inline(always)]
fn walk<'a>(
mut self,
mut visitor: DynVisitor<'a, 'ctx>,
- ) -> Future<'a, Result<Self::Output, Self::Error>, E>
+ ) -> ObjSafe<'a, Result<Self::Output, Self::Error>, E>
where
Self: 'a,
{
- E::wrap(async move {
- // Use the recoverable walk to not duplicate the code.
- let _ = RecoverableScope::<'ctx, E>::new_walk(&mut self, visitor.cast()).await;
-
- // Get the error if there was one.
- match self.error {
- Some(err) => Err(StructWalkError { kind: err }),
- None => Ok(()),
- }
- })
+ todo!()
+ // E::wrap(async move {
+ // // Use the recoverable walk to not duplicate the code.
+ // let _ = RecoverableScope::<'ctx, E>::new_walk(&mut self, visitor.cast()).await;
+ //
+ // // Get the error if there was one.
+ // match self.error {
+ // Some(err) => Err(StructWalkError { kind: err }),
+ // None => Ok(()),
+ // }
+ // })
}
}
@@ -164,25 +166,28 @@ where
I: StructTypeInfo<'ctx, M, S = S>,
Self: AnyTrait<'ctx> + RecoverableScope<'ctx, E>,
{
+ #[inline(always)]
fn hint<'a>(
&'a mut self,
visitor: DynVisitor<'a, 'ctx>,
_hint: <RecoverableProto<E> as HintMeta>::Hint,
- ) -> Future<'a, Flow, E> {
- E::map(
- visit_recoverable::<E>(visitor, self),
- |status| match status {
- VisitResult::Skipped(_) => Flow::Continue,
- VisitResult::Control(flow) => flow,
- },
- )
+ ) -> ObjSafe<'a, Flow, E> {
+ todo!()
+ // E::map(
+ // visit_recoverable::<E>(visitor, self),
+ // |status| match status {
+ // VisitResult::Skipped(_) => Flow::Continue,
+ // VisitResult::Control(flow) => flow,
+ // },
+ // )
}
+ #[inline(always)]
fn known<'a>(
&'a mut self,
_hint: &'a <RecoverableProto<E> as HintMeta>::Hint,
- ) -> Future<'a, Result<MetaKnown<'a, 'ctx, RecoverableProto<E>>, ()>, E> {
- E::ready(Ok(RecoverableKnown))
+ ) -> ObjSafe<'a, Result<MetaKnown<'a, 'ctx, RecoverableProto<E>>, ()>, E> {
+ E::ready(Ok(RecoverableKnown)).into()
}
}
@@ -192,39 +197,42 @@ where
E: Effect,
I: StructTypeInfo<'ctx, M, S = S>,
{
+ #[inline(always)]
fn hint<'a>(
&'a mut self,
visitor: DynVisitor<'a, 'ctx>,
_hint: MetaHint<'a, 'ctx, TagProto<TagConst<{ TAG_FIELD_NAMES.to_int() }>, E>>,
- ) -> Future<'a, Flow, E> {
- E::map(
- visit_tag::<TagConst<{ TAG_FIELD_NAMES.to_int() }>, E, _>(
- TagConst,
- visitor,
- StaticSliceWalker::<_, ValueWalker<&'static str>>::new(I::FIELDS),
- ),
- |status| match status {
- Err(err) => {
- self.error = Some(StructWalkErrorKind::FieldTag(err));
- Flow::Err
- }
- Ok(VisitResult::Skipped(_)) => Flow::Continue,
- Ok(VisitResult::Control(flow)) => flow,
- },
- )
+ ) -> ObjSafe<'a, Flow, E> {
+ todo!()
+ // E::map(
+ // visit_tag::<TagConst<{ TAG_FIELD_NAMES.to_int() }>, E, _>(
+ // TagConst,
+ // visitor,
+ // StaticSliceWalker::<_, ValueWalker<&'static str>>::new(I::FIELDS),
+ // ),
+ // |status| match status {
+ // Err(err) => {
+ // self.error = Some(StructWalkErrorKind::FieldTag(err));
+ // Flow::Err
+ // }
+ // Ok(VisitResult::Skipped(_)) => Flow::Continue,
+ // Ok(VisitResult::Control(flow)) => flow,
+ // },
+ // )
}
+ #[inline(always)]
fn known<'a>(
&'a mut self,
_hint: &'a MetaHint<'a, 'ctx, TagProto<TagConst<{ TAG_FIELD_NAMES.to_int() }>, E>>,
- ) -> Future<
+ ) -> ObjSafe<
'a,
Result<MetaKnown<'a, 'ctx, TagProto<TagConst<{ TAG_FIELD_NAMES.to_int() }>, E>>, ()>,
E,
> {
E::ready(Ok(TagKnown {
kind_available: Some(true),
- }))
+ })).into()
}
}
@@ -234,39 +242,42 @@ where
E: Effect,
I: StructTypeInfo<'ctx, M, S = S>,
{
+ #[inline(always)]
fn hint<'a>(
&'a mut self,
visitor: DynVisitor<'a, 'ctx>,
_hint: <TagProto<TagConst<{ TAG_TYPE_NAME.to_int() }>, E> as HintMeta>::Hint,
- ) -> Future<'a, Flow, E> {
- E::map(
- visit_tag::<TagConst<{ TAG_TYPE_NAME.to_int() }>, E, _>(
- TagConst,
- visitor,
- ValueWalker::new(I::NAME),
- ),
- |status| match status {
- Err(err) => {
- self.error = Some(StructWalkErrorKind::Tag(err));
- Flow::Err
- }
- Ok(VisitResult::Skipped(_)) => Flow::Continue,
- Ok(VisitResult::Control(flow)) => flow,
- },
- )
+ ) -> ObjSafe<'a, Flow, E> {
+ todo!()
+ // E::map(
+ // visit_tag::<TagConst<{ TAG_TYPE_NAME.to_int() }>, E, _>(
+ // TagConst,
+ // visitor,
+ // ValueWalker::new(I::NAME),
+ // ),
+ // |status| match status {
+ // Err(err) => {
+ // self.error = Some(StructWalkErrorKind::Tag(err));
+ // Flow::Err
+ // }
+ // Ok(VisitResult::Skipped(_)) => Flow::Continue,
+ // Ok(VisitResult::Control(flow)) => flow,
+ // },
+ // )
}
+ #[inline(always)]
fn known<'a>(
&'a mut self,
_hint: &'a <TagProto<TagConst<{ TAG_TYPE_NAME.to_int() }>, E> as HintMeta>::Hint,
- ) -> Future<
+ ) -> ObjSafe<
'a,
Result<MetaKnown<'a, 'ctx, TagProto<TagConst<{ TAG_TYPE_NAME.to_int() }>, E>>, ()>,
E,
> {
E::ready(Ok(TagKnown {
kind_available: Some(true),
- }))
+ })).into()
}
}
@@ -276,32 +287,35 @@ where
E: Effect,
I: StructTypeInfo<'ctx, M, S = S>,
{
+ #[inline(always)]
fn hint<'a>(
&'a mut self,
visitor: DynVisitor<'a, 'ctx>,
_hint: <TagProto<TagConst<{ TAG_MAP.to_int() }>, E> as HintMeta>::Hint,
- ) -> Future<'a, Flow, E> {
- E::map(
- visit_tag::<TagConst<{ TAG_MAP.to_int() }>, E, _>(TagConst, visitor, NoopWalker::new()),
- |status| match status {
- Err(err) => {
- self.error = Some(StructWalkErrorKind::Tag(err));
- Flow::Err
- }
- Ok(VisitResult::Skipped(_)) => Flow::Continue,
- Ok(VisitResult::Control(flow)) => flow,
- },
- )
+ ) -> ObjSafe<'a, Flow, E> {
+ todo!()
+ // E::map(
+ // visit_tag::<TagConst<{ TAG_MAP.to_int() }>, E, _>(TagConst, visitor, NoopWalker::new()),
+ // |status| match status {
+ // Err(err) => {
+ // self.error = Some(StructWalkErrorKind::Tag(err));
+ // Flow::Err
+ // }
+ // Ok(VisitResult::Skipped(_)) => Flow::Continue,
+ // Ok(VisitResult::Control(flow)) => flow,
+ // },
+ // )
}
+ #[inline(always)]
fn known<'a>(
&'a mut self,
_hint: &'a <TagProto<TagConst<{ TAG_MAP.to_int() }>, E> as HintMeta>::Hint,
- ) -> Future<'a, Result<MetaKnown<'a, 'ctx, TagProto<TagConst<{ TAG_MAP.to_int() }>, E>>, ()>, E>
+ ) -> ObjSafe<'a, Result<MetaKnown<'a, 'ctx, TagProto<TagConst<{ TAG_MAP.to_int() }>, E>>, ()>, E>
{
E::ready(Ok(TagKnown {
kind_available: Some(true),
- }))
+ })).into()
}
}
@@ -311,39 +325,42 @@ where
E: Effect,
I: StructTypeInfo<'ctx, M, S = S>,
{
+ #[inline(always)]
fn hint<'a>(
&'a mut self,
visitor: DynVisitor<'a, 'ctx>,
_hint: <TagProto<TagConst<{ TAG_STRUCT.to_int() }>, E> as HintMeta>::Hint,
- ) -> Future<'a, Flow, E> {
- E::map(
- visit_tag::<TagConst<{ TAG_STRUCT.to_int() }>, E, _>(
- TagConst,
- visitor,
- NoopWalker::new(),
- ),
- |status| match status {
- Err(err) => {
- self.error = Some(StructWalkErrorKind::Tag(err));
- Flow::Err
- }
- Ok(VisitResult::Skipped(_)) => Flow::Continue,
- Ok(VisitResult::Control(flow)) => flow,
- },
- )
+ ) -> ObjSafe<'a, Flow, E> {
+ todo!()
+ // E::map(
+ // visit_tag::<TagConst<{ TAG_STRUCT.to_int() }>, E, _>(
+ // TagConst,
+ // visitor,
+ // NoopWalker::new(),
+ // ),
+ // |status| match status {
+ // Err(err) => {
+ // self.error = Some(StructWalkErrorKind::Tag(err));
+ // Flow::Err
+ // }
+ // Ok(VisitResult::Skipped(_)) => Flow::Continue,
+ // Ok(VisitResult::Control(flow)) => flow,
+ // },
+ // )
}
+ #[inline(always)]
fn known<'a>(
&'a mut self,
_hint: &'a <TagProto<TagConst<{ TAG_STRUCT.to_int() }>, E> as HintMeta>::Hint,
- ) -> Future<
+ ) -> ObjSafe<
'a,
Result<MetaKnown<'a, 'ctx, TagProto<TagConst<{ TAG_STRUCT.to_int() }>, E>>, ()>,
E,
> {
E::ready(Ok(TagKnown {
kind_available: Some(true),
- }))
+ })).into()
}
}
@@ -354,39 +371,42 @@ where
I: StructTypeInfo<'ctx, M, S = StaticType>,
I::T: 'static,
{
+ #[inline(always)]
fn hint<'a>(
&'a mut self,
visitor: DynVisitor<'a, 'ctx>,
_hint: <TagProto<TagConst<{ TAG_TYPE_ID.to_int() }>, E> as HintMeta>::Hint,
- ) -> Future<'a, Flow, E> {
- E::map(
- visit_tag::<TagConst<{ TAG_TYPE_ID.to_int() }>, E, _>(
- TagConst,
- visitor,
- ValueWalker::new(TypeId::of::<I::T>()),
- ),
- |status| match status {
- Err(err) => {
- self.error = Some(StructWalkErrorKind::Tag(err));
- Flow::Err
- }
- Ok(VisitResult::Skipped(_)) => Flow::Continue,
- Ok(VisitResult::Control(flow)) => flow,
- },
- )
+ ) -> ObjSafe<'a, Flow, E> {
+ todo!()
+ // E::map(
+ // visit_tag::<TagConst<{ TAG_TYPE_ID.to_int() }>, E, _>(
+ // TagConst,
+ // visitor,
+ // ValueWalker::new(TypeId::of::<I::T>()),
+ // ),
+ // |status| match status {
+ // Err(err) => {
+ // self.error = Some(StructWalkErrorKind::Tag(err));
+ // Flow::Err
+ // }
+ // Ok(VisitResult::Skipped(_)) => Flow::Continue,
+ // Ok(VisitResult::Control(flow)) => flow,
+ // },
+ // )
}
+ #[inline(always)]
fn known<'a>(
&'a mut self,
_hint: &'a <TagProto<TagConst<{ TAG_TYPE_ID.to_int() }>, E> as HintMeta>::Hint,
- ) -> Future<
+ ) -> ObjSafe<
'a,
Result<MetaKnown<'a, 'ctx, TagProto<TagConst<{ TAG_TYPE_ID.to_int() }>, E>>, ()>,
E,
> {
E::ready(Ok(TagKnown {
kind_available: Some(true),
- }))
+ })).into()
}
}
@@ -396,11 +416,12 @@ where
I: StructTypeInfo<'ctx, M, S = StaticType>,
I::T: 'static,
{
+ #[inline(always)]
fn hint<'a>(
&'a mut self,
visitor: DynVisitor<'a, 'ctx>,
hint: <TagProto<TagDyn, E> as HintMeta>::Hint,
- ) -> Future<'a, Flow, E> {
+ ) -> ObjSafe<'a, Flow, E> {
match hint.kind.0 {
crate::TAG_TYPE_ID => {
Hint::<'ctx, TagProto<TagConst<{ TAG_TYPE_ID.to_int() }>, E>>::hint(
@@ -432,14 +453,15 @@ where
'ctx,
TagProto<TagConst<{ TAG_FIELD_NAMES.to_int() }>, E>,
>::hint(self, visitor, TagHint { kind: TagConst }),
- _ => E::ready(Flow::Continue),
+ _ => E::ready(Flow::Continue).into(),
}
}
+ #[inline(always)]
fn known<'a>(
&'a mut self,
hint: &'a <TagProto<TagDyn, E> as HintMeta>::Hint,
- ) -> Future<'a, Result<MetaKnown<'a, 'ctx, TagProto<TagDyn, E>>, ()>, E> {
+ ) -> ObjSafe<'a, Result<MetaKnown<'a, 'ctx, TagProto<TagDyn, E>>, ()>, E> {
E::ready(match hint.kind {
TagDyn(crate::TAG_TYPE_ID) | TagDyn(crate::TAG_STRUCT) => Ok(TagKnown {
kind_available: Some(true),
@@ -447,7 +469,7 @@ where
_ => Ok(TagKnown {
kind_available: Some(false),
}),
- })
+ }).into()
}
}
@@ -458,21 +480,24 @@ where
I: StructTypeInfo<'ctx, M, S = StaticType>,
I::T: 'static,
{
- fn hint<'a>(&'a mut self, visitor: DynVisitor<'a, 'ctx>, _hint: ()) -> Future<'a, Flow, E> {
- E::map(
- visit_value::<_, E>(visitor, BorrowedStatic(self.value)),
- |status| match status {
- VisitResult::Skipped(_) => Flow::Continue,
- VisitResult::Control(flow) => flow,
- },
- )
+ #[inline(always)]
+ fn hint<'a>(&'a mut self, visitor: DynVisitor<'a, 'ctx>, _hint: ()) -> ObjSafe<'a, Flow, E> {
+ todo!()
+ // E::map(
+ // visit_value::<_, E>(visitor, BorrowedStatic(self.value)),
+ // |status| match status {
+ // VisitResult::Skipped(_) => Flow::Continue,
+ // VisitResult::Control(flow) => flow,
+ // },
+ // )
}
+ #[inline(always)]
fn known<'a>(
&'a mut self,
_hint: &'a (),
- ) -> Future<'a, Result<ValueKnown<'a, BorrowedStatic<'ctx, I::T>>, ()>, E> {
- E::ready(Ok(ValueKnown { preview: None }))
+ ) -> ObjSafe<'a, Result<ValueKnown<'a, BorrowedStatic<'ctx, I::T>>, ()>, E> {
+ E::ready(Ok(ValueKnown { preview: None })).into()
}
}
@@ -481,26 +506,29 @@ where
E: Effect,
I: StructTypeInfo<'ctx, M, S = S>,
{
+ #[inline(always)]
fn hint<'a>(
&'a mut self,
visitor: DynVisitor<'a, 'ctx>,
_hint: <SequenceProto<E> as HintMeta>::Hint,
- ) -> Future<'a, Flow, E> {
- E::map(visit_sequence::<E>(visitor, self), |status| match status {
- VisitResult::Skipped(_) => Flow::Continue,
- VisitResult::Control(flow) => flow,
- })
+ ) -> ObjSafe<'a, Flow, E> {
+ todo!()
+ // E::map(visit_sequence::<E>(visitor, self), |status| match status {
+ // VisitResult::Skipped(_) => Flow::Continue,
+ // VisitResult::Control(flow) => flow,
+ // })
}
+ #[inline(always)]
fn known<'a>(
&'a mut self,
_hint: &'a <SequenceProto<E> as HintMeta>::Hint,
- ) -> Future<'a, Result<MetaKnown<'a, 'ctx, SequenceProto<E>>, ()>, E> {
+ ) -> ObjSafe<'a, Result<MetaKnown<'a, 'ctx, SequenceProto<E>>, ()>, E> {
let len = I::FIELDS.len();
E::ready(Ok(SequenceKnown {
len: (len, Some(len)),
- }))
+ })).into()
}
}
@@ -509,31 +537,34 @@ where
E: Effect,
I: StructTypeInfo<'ctx, M, S = S>,
{
- fn size_hint(&mut self) -> Future<'_, (usize, Option<usize>), E> {
+ #[inline(always)]
+ fn size_hint(&mut self) -> ObjSafe<'_, (usize, Option<usize>), E> {
let len = I::FIELDS.len();
- E::ready((len, Some(len)))
+ E::ready((len, Some(len))).into()
}
- fn next<'a>(&'a mut self, visitor: DynVisitor<'a, 'ctx>) -> Future<'a, Flow, E> {
+ #[inline(always)]
+ fn next<'a>(&'a mut self, visitor: DynVisitor<'a, 'ctx>) -> ObjSafe<'a, Flow, E> {
if self.index >= I::FIELDS.len() {
- return E::ready(Flow::Done);
+ return E::ready(Flow::Done).into();
}
let index = self.index;
self.index += 1;
- E::map(
- I::walk_field::<E>(index, self.value, visitor),
- |result| match result {
- Ok(flow) => flow,
- Err(err) => {
- // Record the error and signal a break.
- self.error = Some(StructWalkErrorKind::Field(err));
- Flow::Err
- }
- },
- )
+ todo!()
+ // E::map(
+ // I::walk_field::<E>(index, self.value, visitor),
+ // |result| match result {
+ // Ok(flow) => flow,
+ // Err(err) => {
+ // // Record the error and signal a break.
+ // self.error = Some(StructWalkErrorKind::Field(err));
+ // Flow::Err
+ // }
+ // },
+ // )
}
}
@@ -544,123 +575,124 @@ where
I::T: 'static,
{
#[inline(always)]
- fn new_walk<'a>(&'a mut self, mut visitor: DynVisitor<'a, 'ctx>) -> Future<'a, Status, E> {
+ fn new_walk<'a>(&'a mut self, mut visitor: DynVisitor<'a, 'ctx>) -> ObjSafe<'a, Status, E> {
// Reset the errors to default state.
self.error = None;
// Reset the field index to the default.
self.index = 0;
- E::wrap(async move {
- // We should check if the visitor wants something specific.
- match visit_request_hint::<E>(visitor.cast(), DynWalker(self)).await {
- VisitResult::Skipped(_) | VisitResult::Control(Flow::Continue) => {}
- VisitResult::Control(Flow::Done) => return Ok(()),
- VisitResult::Control(Flow::Err) => return Err(()),
- }
-
- // Attempt to visit the value directly.
- match visit_value::<_, E>(visitor.cast(), BorrowedStatic(self.value)).await {
- VisitResult::Skipped(_) | VisitResult::Control(Flow::Continue) => {}
- VisitResult::Control(Flow::Done) => return Ok(()),
- VisitResult::Control(Flow::Err) => return Err(()),
- }
-
- // Follow the standard set of protocols for a struct.
- // - Tagged: type ID
- // - Tagged: struct
- // - Tagged: struct name
- // - Tagged: struct field names
- // - Sequence: the fields
-
- match visit_tag::<TagConst<{ TAG_TYPE_ID.to_int() }>, E, _>(
- TagConst,
- visitor.cast(),
- ValueWalker::new(TypeId::of::<I::T>()),
- )
- .await
- {
- Err(err) => {
- self.error = Some(StructWalkErrorKind::Tag(err));
- return Err(());
- }
- Ok(VisitResult::Skipped(_)) | Ok(VisitResult::Control(Flow::Continue)) => {}
- Ok(VisitResult::Control(Flow::Done)) => return Ok(()),
- Ok(VisitResult::Control(Flow::Err)) => return Err(()),
- }
-
- match visit_tag::<TagConst<{ TAG_STRUCT.to_int() }>, E, _>(
- TagConst,
- visitor.cast(),
- NoopWalker::new(),
- )
- .await
- {
- Ok(VisitResult::Skipped(_)) => {
- match visit_tag::<TagConst<{ TAG_MAP.to_int() }>, E, _>(
- TagConst,
- visitor.cast(),
- NoopWalker::new(),
- )
- .await
- {
- Err(err) => {
- self.error = Some(StructWalkErrorKind::Tag(err));
- return Err(());
- }
- Ok(VisitResult::Skipped(_)) | Ok(VisitResult::Control(Flow::Continue)) => {}
- Ok(VisitResult::Control(Flow::Done)) => return Ok(()),
- Ok(VisitResult::Control(Flow::Err)) => return Err(()),
- }
- }
- Err(err) => {
- self.error = Some(StructWalkErrorKind::Tag(err));
- return Err(());
- }
- Ok(VisitResult::Control(Flow::Continue)) => {}
- Ok(VisitResult::Control(Flow::Done)) => return Ok(()),
- Ok(VisitResult::Control(Flow::Err)) => return Err(()),
- }
-
- match visit_tag::<TagConst<{ TAG_TYPE_NAME.to_int() }>, E, _>(
- TagConst,
- visitor.cast(),
- ValueWalker::new(I::NAME),
- )
- .await
- {
- Err(err) => {
- self.error = Some(StructWalkErrorKind::Tag(err));
- return Err(());
- }
- Ok(VisitResult::Skipped(_)) | Ok(VisitResult::Control(Flow::Continue)) => {}
- Ok(VisitResult::Control(Flow::Done)) => return Ok(()),
- Ok(VisitResult::Control(Flow::Err)) => return Err(()),
- }
-
- match visit_tag::<TagConst<{ TAG_FIELD_NAMES.to_int() }>, E, _>(
- TagConst,
- visitor.cast(),
- StaticSliceWalker::<_, ValueWalker<&'static str>>::new(I::FIELDS),
- )
- .await
- {
- Err(err) => {
- self.error = Some(StructWalkErrorKind::FieldTag(err));
- return Err(());
- }
- Ok(VisitResult::Skipped(_)) | Ok(VisitResult::Control(Flow::Continue)) => {}
- Ok(VisitResult::Control(Flow::Done)) => return Ok(()),
- Ok(VisitResult::Control(Flow::Err)) => return Err(()),
- }
-
- match visit_sequence::<E>(visitor, self).await {
- VisitResult::Control(Flow::Continue) | VisitResult::Skipped(_) => {}
- VisitResult::Control(Flow::Done) => return Ok(()),
- VisitResult::Control(Flow::Err) => return Err(()),
- }
-
- Ok(())
- })
+ todo!()
+ // E::wrap(async move {
+ // // // We should check if the visitor wants something specific.
+ // // match visit_request_hint::<E>(visitor.cast(), DynWalker(self)).await {
+ // // VisitResult::Skipped(_) | VisitResult::Control(Flow::Continue) => {}
+ // // VisitResult::Control(Flow::Done) => return Ok(()),
+ // // VisitResult::Control(Flow::Err) => return Err(()),
+ // // }
+ // //
+ // // // Attempt to visit the value directly.
+ // // match visit_value::<_, E>(visitor.cast(), BorrowedStatic(self.value)).await {
+ // // VisitResult::Skipped(_) | VisitResult::Control(Flow::Continue) => {}
+ // // VisitResult::Control(Flow::Done) => return Ok(()),
+ // // VisitResult::Control(Flow::Err) => return Err(()),
+ // // }
+ // //
+ // // // Follow the standard set of protocols for a struct.
+ // // // - Tagged: type ID
+ // // // - Tagged: struct
+ // // // - Tagged: struct name
+ // // // - Tagged: struct field names
+ // // // - Sequence: the fields
+ // //
+ // // match visit_tag::<TagConst<{ TAG_TYPE_ID.to_int() }>, E, _>(
+ // // TagConst,
+ // // visitor.cast(),
+ // // ValueWalker::new(TypeId::of::<I::T>()),
+ // // )
+ // // .await
+ // // {
+ // // Err(err) => {
+ // // self.error = Some(StructWalkErrorKind::Tag(err));
+ // // return Err(());
+ // // }
+ // // Ok(VisitResult::Skipped(_)) | Ok(VisitResult::Control(Flow::Continue)) => {}
+ // // Ok(VisitResult::Control(Flow::Done)) => return Ok(()),
+ // // Ok(VisitResult::Control(Flow::Err)) => return Err(()),
+ // // }
+ // //
+ // // match visit_tag::<TagConst<{ TAG_STRUCT.to_int() }>, E, _>(
+ // // TagConst,
+ // // visitor.cast(),
+ // // NoopWalker::new(),
+ // // )
+ // // .await
+ // // {
+ // // Ok(VisitResult::Skipped(_)) => {
+ // // match visit_tag::<TagConst<{ TAG_MAP.to_int() }>, E, _>(
+ // // TagConst,
+ // // visitor.cast(),
+ // // NoopWalker::new(),
+ // // )
+ // // .await
+ // // {
+ // // Err(err) => {
+ // // self.error = Some(StructWalkErrorKind::Tag(err));
+ // // return Err(());
+ // // }
+ // // Ok(VisitResult::Skipped(_)) | Ok(VisitResult::Control(Flow::Continue)) => {}
+ // // Ok(VisitResult::Control(Flow::Done)) => return Ok(()),
+ // // Ok(VisitResult::Control(Flow::Err)) => return Err(()),
+ // // }
+ // // }
+ // // Err(err) => {
+ // // self.error = Some(StructWalkErrorKind::Tag(err));
+ // // return Err(());
+ // // }
+ // // Ok(VisitResult::Control(Flow::Continue)) => {}
+ // // Ok(VisitResult::Control(Flow::Done)) => return Ok(()),
+ // // Ok(VisitResult::Control(Flow::Err)) => return Err(()),
+ // // }
+ // //
+ // // match visit_tag::<TagConst<{ TAG_TYPE_NAME.to_int() }>, E, _>(
+ // // TagConst,
+ // // visitor.cast(),
+ // // ValueWalker::new(I::NAME),
+ // // )
+ // // .await
+ // // {
+ // // Err(err) => {
+ // // self.error = Some(StructWalkErrorKind::Tag(err));
+ // // return Err(());
+ // // }
+ // // Ok(VisitResult::Skipped(_)) | Ok(VisitResult::Control(Flow::Continue)) => {}
+ // // Ok(VisitResult::Control(Flow::Done)) => return Ok(()),
+ // // Ok(VisitResult::Control(Flow::Err)) => return Err(()),
+ // // }
+ // //
+ // // match visit_tag::<TagConst<{ TAG_FIELD_NAMES.to_int() }>, E, _>(
+ // // TagConst,
+ // // visitor.cast(),
+ // // StaticSliceWalker::<_, ValueWalker<&'static str>>::new(I::FIELDS),
+ // // )
+ // // .await
+ // // {
+ // // Err(err) => {
+ // // self.error = Some(StructWalkErrorKind::FieldTag(err));
+ // // return Err(());
+ // // }
+ // // Ok(VisitResult::Skipped(_)) | Ok(VisitResult::Control(Flow::Continue)) => {}
+ // // Ok(VisitResult::Control(Flow::Done)) => return Ok(()),
+ // // Ok(VisitResult::Control(Flow::Err)) => return Err(()),
+ // // }
+ //
+ // match visit_sequence::<E>(visitor, self).await {
+ // VisitResult::Control(Flow::Continue) | VisitResult::Skipped(_) => {}
+ // VisitResult::Control(Flow::Done) => return Ok(()),
+ // VisitResult::Control(Flow::Err) => return Err(()),
+ // }
+ //
+ // Ok(())
+ // })
}
}