1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
use crate::protocol::Implementer;

pub trait WalkOnce<'ctx> {
    type Error;
    type Value;

    fn walk_once(self, visitor: &mut dyn Implementer<'ctx>) -> Result<Self::Value, Self::Error>;
}

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 Walk<'borrow, 'ctx>: WalkMut<'borrow, 'ctx> {
    fn walk(&'borrow self, visitor: &mut dyn Implementer<'ctx>)
        -> Result<Self::Value, Self::Error>;
}