Diffstat (limited to 'tests/demo.rs')
| -rw-r--r-- | tests/demo.rs | 21 |
1 files changed, 14 insertions, 7 deletions
diff --git a/tests/demo.rs b/tests/demo.rs index 6db1559..9812ef6 100644 --- a/tests/demo.rs +++ b/tests/demo.rs @@ -25,6 +25,11 @@ fn demo() { let s = build_with::<array::Builder<'_, JsonLike, 3>, _>(into_walker(&a)).unwrap(); dbg!(s); + use treaty::builders::serde::deserialize::Builder as SerdeBuilder; + + let x = build_with::<SerdeBuilder<serde_json::Value>, _>(into_walker(&a)).unwrap(); + dbg!(x); + // let s = build_with::<JsonLike, _>(into_walker(a)).unwrap(); todo!(); @@ -98,13 +103,9 @@ fn walk_vec<'a, 'ctx>(value: &'ctx [Data], visitor: &'a mut Visitor<'a, 'ctx>) { if let Some(value) = self.0.pop_front() { into_walker(value).walk(visitor); - ControlFlow::Continue( - treaty::protocol::visitor::Status::Continue, - ) + ControlFlow::Continue(treaty::protocol::visitor::Status::Continue) } else { - ControlFlow::Continue( - treaty::protocol::visitor::Status::Done, - ) + ControlFlow::Continue(treaty::protocol::visitor::Status::Done) } } } @@ -132,13 +133,19 @@ impl<'ctx> Builder<'ctx> for JsonLike { fn build(self) -> Result<Self::Value, Self::Error> { Ok(self.0) } + + type Seed = (); + + fn from_seed(seed: Self::Seed) -> Self { + Self::default() + } } any_trait! { impl['a, 'ctx] JsonLike = [ dyn Value<'a, OwnedStatic<bool>> + 'a, dyn Sequence<'ctx> + 'a, - ]; + ] } impl Value<'_, OwnedStatic<bool>> for JsonLike { |