1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
use crate::Visitor;

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

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

pub trait WalkMut<'borrow, 'ctx>: WalkOnce<'ctx> {
    fn walk_mut(&'borrow mut self, visitor: &mut dyn Visitor<'ctx>) -> Result<Self::Value, Self::Error>;
}

pub trait Walk<'borrow, 'ctx>: WalkMut<'borrow, 'ctx> {
    fn walk(&'borrow self, visitor: &mut dyn Visitor<'ctx>) -> Result<Self::Value, Self::Error>;
}