Diffstat (limited to 'src/lib.rs')
-rw-r--r--src/lib.rs34
1 files changed, 14 insertions, 20 deletions
diff --git a/src/lib.rs b/src/lib.rs
index c4b7528..49232de 100644
--- a/src/lib.rs
+++ b/src/lib.rs
@@ -123,7 +123,7 @@ macro_rules! Walk {
} => {
const _: () = {
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, Info, $crate::walkers::core::r#struct::StaticType, M, E>;
+ type Walker = $crate::walkers::core::r#struct::StructWalker<'ctx, Info, $crate::any::StaticType, M, E>;
fn into_walker(self) -> Self::Walker {
$crate::walkers::core::r#struct::StructWalker::new(self)
@@ -153,7 +153,7 @@ macro_rules! Walk {
type FieldError = FieldError<'ctx>;
type T = $name;
- type S = $crate::walkers::core::r#struct::StaticType;
+ type S = $crate::any::StaticType;
#[allow(unreachable_code, non_snake_case, non_upper_case_globals, non_camel_case_types)]
fn walk_field<'a, E: $crate::effect::Effect>(
@@ -242,44 +242,38 @@ macro_rules! Walk {
// }
// }
-
pub mod demo {
- use crate::Walk;
- use macro_rules_attribute::derive;
use crate::{
effect::{
blocking::{BlockOn, Blocking, Spin},
// r#async::Async,
Effective as _,
},
- transform, Build, DefaultMode,
+ transform, Build, BuildExt as _, DefaultMode,
};
+ use crate::{Walk, WalkExt as _};
+ use macro_rules_attribute::derive;
- #[derive(Walk!, Debug)]
+ #[derive(Walk!)]
pub struct X {
pub a: bool,
pub b: bool,
- pub c: bool,
}
- #[derive(Build!, Debug, PartialEq)]
+ #[derive(Build!, PartialEq, Debug)]
pub struct Y {
- pub a: bool,
pub b: bool,
- pub c: bool,
+ pub a: bool,
}
#[inline(never)]
pub fn ident(x: X) -> Y {
- let other =
- transform::<<Y as crate::Build<'_, DefaultMode, _>>::Builder, _, Blocking<Spin>>(
- ((), (), ()),
- Walk::<DefaultMode, _>::into_walker(&x),
- )
- .value();
-
- // let other = Spin::block_on(other.into_future());
+ // Y::build(x.as_walker()).unwrap()
+ x.walk(Y::new_builder()).unwrap()
+ }
- other.0.unwrap()
+ #[test]
+ fn demo() {
+ assert_eq!(ident(X { a: true, b: false }), Y { a: true, b: false });
}
}