Diffstat (limited to 'src/walk.rs')
| -rw-r--r-- | src/walk.rs | 23 |
1 files changed, 9 insertions, 14 deletions
diff --git a/src/walk.rs b/src/walk.rs index 9d218b1..8f3907e 100644 --- a/src/walk.rs +++ b/src/walk.rs @@ -1,20 +1,15 @@ -use crate::protocol::Implementer; +pub mod protocols; +pub mod walkers; -pub trait WalkOnce<'ctx> { - type Error; - type Value; +use crate::protocol::Implementer; - fn walk_once(self, visitor: &mut dyn Implementer<'ctx>) -> Result<Self::Value, Self::Error>; +pub trait Walk<'ctx>: Sized { + type Walker: Walker<'ctx> + From<Self>; } -pub trait WalkMut<'borrow, 'ctx>: WalkOnce<'ctx> { - fn walk_mut( - &'borrow mut self, - visitor: &mut dyn Implementer<'ctx>, - ) -> Result<Self::Value, Self::Error>; -} +pub trait Walker<'ctx> { + type Error; + type Value; -pub trait Walk<'borrow, 'ctx>: WalkMut<'borrow, 'ctx> { - fn walk(&'borrow self, visitor: &mut dyn Implementer<'ctx>) - -> Result<Self::Value, Self::Error>; + fn walk(self, visitor: &mut dyn Implementer<'ctx>) -> Result<Self::Value, Self::Error>; } |