Diffstat (limited to 'src/walk.rs')
-rw-r--r--src/walk.rs16
1 files changed, 8 insertions, 8 deletions
diff --git a/src/walk.rs b/src/walk.rs
index 5bdd5ec..349a63d 100644
--- a/src/walk.rs
+++ b/src/walk.rs
@@ -2,7 +2,7 @@ pub mod walkers;
use crate::{
effect::{Effect, Future},
- protocol::Visitor,
+ protocol::DynVisitor,
Flow,
};
@@ -16,12 +16,12 @@ pub trait Walk<'ctx, M, E: Effect>: WalkerTypes + Sized {
}
pub trait WalkerTypes {
- type Error: Send;
+ type Error: Send + Sync;
/// An arbitrary type the walker is left with after walking.
///
/// Its recommended that this is `Self` if the walker is repeatable.
- type Output: Send;
+ type Output: Send + Sync;
}
/// Walker for a type.
@@ -33,25 +33,25 @@ pub trait WalkerTypes {
/// - Call [From::from()] with a value to be walked to make a walker.
/// - Call [Self::walk()] to walk the value. Data will be sent to the provided
/// visitor.
-pub trait Walker<'ctx, E: Effect>: WalkerTypes + Send {
+pub trait Walker<'ctx, E: Effect>: WalkerTypes + Send + Sync {
/// Walk the value.
///
/// The walker should send data to the `visitor` as it walks the value.
fn walk<'a>(
self,
- visitor: Visitor<'a, 'ctx>,
+ visitor: DynVisitor<'a, 'ctx>,
) -> Future<'a, Result<Self::Output, Self::Error>, E>
where
Self: 'a;
}
pub trait WalkerObjSafe<'ctx, E: Effect>: Send {
- fn walk<'a>(&'a mut self, visitor: Visitor<'a, 'ctx>) -> Future<'a, Flow, E>
+ fn walk<'a>(&'a mut self, visitor: DynVisitor<'a, 'ctx>) -> Future<'a, Flow, E>
where
Self: 'a;
}
-pub type DynWalker<'a, 'ctx, E> = &'a mut (dyn WalkerObjSafe<'ctx, E> + Send + 'a);
+pub type DynWalkerObjSafe<'a, 'ctx, E> = &'a mut (dyn WalkerObjSafe<'ctx, E> + Send + 'a);
enum DynWalkerState<W: WalkerTypes> {
Walking,
@@ -103,7 +103,7 @@ impl<W: WalkerTypes> DynWalkerAdapter<W> {
}
impl<'ctx, W: Walker<'ctx, E>, E: Effect> WalkerObjSafe<'ctx, E> for DynWalkerAdapter<W> {
- fn walk<'a>(&'a mut self, visitor: Visitor<'a, 'ctx>) -> Future<'a, Flow, E>
+ fn walk<'a>(&'a mut self, visitor: DynVisitor<'a, 'ctx>) -> Future<'a, Flow, E>
where
Self: 'a,
{