Diffstat (limited to 'tests/common/protocol/recoverable.rs')
| -rw-r--r-- | tests/common/protocol/recoverable.rs | 28 |
1 files changed, 13 insertions, 15 deletions
diff --git a/tests/common/protocol/recoverable.rs b/tests/common/protocol/recoverable.rs index 285e960..721deec 100644 --- a/tests/common/protocol/recoverable.rs +++ b/tests/common/protocol/recoverable.rs @@ -1,8 +1,8 @@ use effectful::{ - blocking::Blocking as Block, + blocking::BlockingSpin, bound::{Bool, IsSend, IsSync}, - effective::Effective, - environment::{Environment, NativeForm}, + effective::{Effective, Canonical}, + environment::{Environment}, forward_send_sync, }; use mockall::mock; @@ -18,15 +18,13 @@ use treaty::{ Flow, Status, }; -use crate::common::Blocking; - mock! { pub RecoverableVisitor<E: Environment> { pub fn visit<'a, 'ctx>(&mut self, scope: DynRecoverableScope<'a, 'ctx, E>) -> VisitResult; } } -forward_send_sync!({} {} {E: (Environment)} MockRecoverableVisitor<E>); +forward_send_sync!({} {} {E: (Environment + Send)} MockRecoverableVisitor<E>); // any_trait! { // impl['ctx][E] MockRecoverableVisitor<E> = [ @@ -35,11 +33,11 @@ forward_send_sync!({} {} {E: (Environment)} MockRecoverableVisitor<E>); // E: Environment, // } -impl<'ctx, E: Environment> Recoverable<'ctx, E> for MockRecoverableVisitor<E> { +impl<'ctx, E: Environment + Send> Recoverable<'ctx, E> for MockRecoverableVisitor<E> { fn visit<'a>( &'a mut self, scope: DynRecoverableScope<'a, 'ctx, E>, - ) -> NativeForm<'a, VisitResult, E> { + ) -> Canonical<'a, VisitResult, E> { E::value(self.visit(scope)).cast() } } @@ -50,30 +48,30 @@ mock! { } } -forward_send_sync!({} {} {E: (Environment)} MockRecoverableScopeVisitor<E>); +forward_send_sync!({} {} {E: (Environment + Send)} MockRecoverableScopeVisitor<E>); -impl<'ctx, E: Environment> RecoverableScope<'ctx, E> for MockRecoverableScopeVisitor<E> { +impl<'ctx, E: Environment + Send> RecoverableScope<'ctx, E> for MockRecoverableScopeVisitor<E> { fn new_walk<'a: 'c, 'b: 'c, 'c>( &'a mut self, visitor: DynVisitor<'b, 'ctx, E>, - ) -> NativeForm<'c, Status, E> { + ) -> Canonical<'c, Status, E> { E::value(self.new_walk(visitor)).cast() } } pub trait RecoverableVisitorExt<'ctx> { - fn visit_recoverable_and_done<'a>(&'a mut self, scope: DynRecoverableScope<'a, 'ctx, Blocking>); + fn visit_recoverable_and_done<'a>(&'a mut self, scope: DynRecoverableScope<'a, 'ctx, BlockingSpin>); } impl<'ctx, T> RecoverableVisitorExt<'ctx> for T where - T: AsVisitor<'ctx, Blocking>, + T: AsVisitor<'ctx, BlockingSpin>, { fn visit_recoverable_and_done<'a>( &'a mut self, - scope: DynRecoverableScope<'a, 'ctx, Blocking>, + scope: DynRecoverableScope<'a, 'ctx, BlockingSpin>, ) { - let result = visit_recoverable(self.as_visitor(), scope).into_value(); + let result = visit_recoverable(self.as_visitor(), scope).wait(); assert_eq!(result, VisitResult::Control(Flow::Done)); } |