Diffstat (limited to 'src/lib.rs')
| -rw-r--r-- | src/lib.rs | 103 |
1 files changed, 45 insertions, 58 deletions
@@ -15,27 +15,13 @@ pub mod protocol; pub mod symbol; mod transform; mod walk; - -#[cfg(any(test, feature = "mock"))] -pub mod mock; - -// pub use build::Build; -// pub use build::Builder; -// -// pub use walk::Walk; -// pub use walk::Walker; - -use core::ops::ControlFlow; +pub mod macros; pub use build::*; -use effect::{Effect, Future}; -// use protocol::{visitor::tag::TagError, Visitor}; -use symbol::Symbol; pub use transform::*; pub use walk::*; -// #[doc(hidden)] -pub mod macros; +use symbol::Symbol; pub mod never { mod sealed { @@ -93,7 +79,7 @@ macro_rules! Walk { ),* $(,)?} } => { const _: () = { - impl<'ctx, M: 'ctx, E: $crate::effect::Effect<'ctx>> $crate::Walk<'ctx, M, E> for &'ctx $name { + impl<'ctx, M: 'ctx, E: $crate::effect::Effect> $crate::Walk<'ctx, M, E> for &'ctx $name { type Walker = $crate::walkers::core::r#struct::StructWalker<'ctx, $name, Info, M, E>; fn into_walker(self) -> Self::Walker { @@ -109,12 +95,13 @@ macro_rules! Walk { $vis enum Info {} #[derive(Debug)] - #[allow(non_camel_case_types)] + #[allow(non_camel_case_types, unused)] enum FieldErrorKind<'ctx> {$( $field($crate::walkers::core::key_value::KeyValueError<$crate::never::Never, <&'ctx $type as $crate::WalkerTypes>::Error>) ),*} #[derive(Debug)] + #[allow(unused)] $vis struct FieldError<'ctx>(FieldErrorKind<'ctx>); impl<'ctx, M: 'ctx> $crate::walkers::core::r#struct::StructTypeInfo<'ctx, M> for Info { @@ -125,11 +112,11 @@ macro_rules! Walk { type T = $name; #[allow(unreachable_code, non_snake_case, non_upper_case_globals, non_camel_case_types)] - fn walk_field<'a, E: $crate::effect::Effect<'ctx>>( + fn walk_field<'a, E: $crate::effect::Effect>( index: usize, value: &'ctx Self::T, visitor: $crate::protocol::Visitor<'a, 'ctx>, - ) -> $crate::effect::Future<'a, 'ctx, Result<$crate::Flow, Self::FieldError>, E> { + ) -> $crate::effect::Future<'a, Result<$crate::Flow, Self::FieldError>, E> { mod fields { enum Fields {$($field),*} @@ -173,41 +160,41 @@ Walk! { } } -#[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!(); +// } +// } |