Diffstat (limited to 'src/lib.rs')
| -rw-r--r-- | src/lib.rs | 107 |
1 files changed, 54 insertions, 53 deletions
@@ -8,13 +8,13 @@ extern crate alloc; pub mod any; -// mod build; +mod build; pub mod effect; pub mod hkt; -// pub mod protocol; +pub mod protocol; pub mod symbol; -// mod walk; -// mod transform; +mod transform; +mod walk; // pub use build::Build; // pub use build::Builder; @@ -24,12 +24,12 @@ pub mod symbol; use core::ops::ControlFlow; -// pub use build::*; -// use effect::{Effect, Future}; +pub use build::*; +use effect::{Effect, Future}; // use protocol::{visitor::tag::TagError, Visitor}; use symbol::Symbol; -// pub use transform::*; -// pub use walk::*; +pub use transform::*; +pub use walk::*; // #[doc(hidden)] pub mod macros; @@ -66,6 +66,7 @@ pub const TAG_ENUM: Symbol = Symbol::new("Enum"); pub enum DefaultMode {} +#[derive(Clone, Copy, PartialEq, Debug)] #[must_use] pub enum Flow { /// Processing should continue as normal. @@ -124,7 +125,7 @@ macro_rules! Walk { fn walk_field<'a, E: $crate::effect::Effect<'ctx>>( index: usize, value: &'ctx Self::T, - visitor: $crate::Visitor<'a, 'ctx>, + visitor: $crate::protocol::Visitor<'a, 'ctx>, ) -> $crate::effect::Future<'a, 'ctx, Result<$crate::Flow, Self::FieldError>, E> { mod fields { enum Fields {$($field),*} @@ -162,48 +163,48 @@ pub struct Demo { pub b: bool, } -// Walk! { -// pub struct Demo { -// a: bool, -// b: bool, -// } -// } +Walk! { + pub struct Demo { + a: bool, + b: bool, + } +} -// #[cfg(test)] -// mod test { -// use crate::effect::{BlockOn, Blocking, Spin}; -// -// use super::*; -// use macro_rules_attribute::derive; -// -// #[derive(Walk!)] -// struct Demo { -// a: bool, -// b: bool, -// other: Other, -// } -// -// #[derive(Walk!)] -// struct Other { -// value: bool, -// } -// -// #[test] -// fn demo() { -// let value = Demo { -// a: true, -// b: false, -// other: Other { value: true }, -// }; -// -// let walker = Walk::<DefaultMode, Blocking>::into_walker(&value); -// let mut visitor = builders::debug::Visitor::<Blocking>::new(); -// -// dbg!(Spin::block_on(Walker::<Blocking>::walk( -// walker, -// &mut visitor -// ))); -// -// todo!(); -// } -// } +#[cfg(test)] +mod test { + use crate::effect::{BlockOn, Blocking, Spin}; + + use super::*; + use macro_rules_attribute::derive; + + #[derive(Walk!)] + struct Demo { + a: bool, + b: bool, + other: Other, + } + + #[derive(Walk!)] + struct Other { + value: bool, + } + + #[test] + fn demo() { + let value = Demo { + a: true, + b: false, + other: Other { value: true }, + }; + + let walker = Walk::<DefaultMode, Blocking>::into_walker(&value); + let mut visitor = builders::debug::Visitor::<Blocking>::new(); + + dbg!(Spin::block_on(Walker::<Blocking>::walk( + walker, + &mut visitor + ))); + + todo!(); + } +} |