Diffstat (limited to 'tests/demo.rs')
| -rw-r--r-- | tests/demo.rs | 20 |
1 files changed, 12 insertions, 8 deletions
diff --git a/tests/demo.rs b/tests/demo.rs index c644f73..b6bf557 100644 --- a/tests/demo.rs +++ b/tests/demo.rs @@ -3,10 +3,11 @@ use treaty::{ any::{any_trait, static_wrapper::OwnedStatic}, build, build_with, builders::core::array, + effect::{SyncEffect, Yield}, into_walker, protocol::{ visitor::{Sequence, SequenceScope, Value}, - Yield, SyncEffect, Visitor, + Visitor, }, AsVisitor, Builder, Walk, Walker, }; @@ -132,7 +133,10 @@ impl<'ctx> Builder<'ctx, SyncEffect> for JsonLike { type Value = String; - fn build<'a>(self) -> Result<Self::Value, Self::Error> where Self: 'a { + fn build<'a>(self) -> Result<Self::Value, Self::Error> + where + Self: 'a, + { Ok(self.0) } @@ -153,16 +157,16 @@ impl<'ctx> AsVisitor<'ctx, SyncEffect> for JsonLike { any_trait! { impl['a, 'ctx] JsonLike = [ - dyn Value<'ctx, OwnedStatic<bool>, SyncEffect> + 'a, + dyn Value<'a, 'ctx, OwnedStatic<bool>, SyncEffect> + 'a, dyn Sequence<'ctx, SyncEffect> + 'a, ] } -impl<'ctx> Value<'ctx, OwnedStatic<bool>, SyncEffect> for JsonLike { - fn visit<'a>(&'a mut self, value: OwnedStatic<bool>) -> Yield<'a, 'ctx, ControlFlow<(), ()>, SyncEffect> - where - 'ctx: 'a, - { +impl<'a, 'ctx: 'a> Value<'a, 'ctx, OwnedStatic<bool>, SyncEffect> for JsonLike { + fn visit( + &'a mut self, + value: OwnedStatic<bool>, + ) -> Yield<'a, 'ctx, ControlFlow<(), ()>, SyncEffect> { self.0.push_str(&format!("{}", value.0)); ControlFlow::Continue(()) } |