Diffstat (limited to 'src/walk.rs')
-rw-r--r--src/walk.rs17
1 files changed, 10 insertions, 7 deletions
diff --git a/src/walk.rs b/src/walk.rs
index e73df28..7f8c82a 100644
--- a/src/walk.rs
+++ b/src/walk.rs
@@ -41,11 +41,14 @@ pub trait WalkMut<'value, 'ctx: 'value, VisitorErr> {
fn walker_mut(&'value mut self) -> Self::WalkerMut;
}
-pub trait Walk<'value, 'ctx: 'value, VisitorErr>: WalkMut<'value, 'ctx, VisitorErr> {
+/// `'borrow` is a lifetime between `'value` and `'ctx`.
+/// `'borrow` is the lifetime self will be borrowed from to make the walker.
+/// This allows references to raise their lifetime to `'ctx`.
+pub trait Walk<'value, 'borrow: 'value, 'ctx: 'borrow, VisitorErr> /*WalkMut<'value, 'ctx, VisitorErr>*/ {
type Error: WalkerError<'value, 'ctx>;
type Walker: Walker<'value, 'ctx, VisitorErr, Error = Self::Error>;
- fn walker(&'value self) -> Self::Walker;
+ fn walker(&'borrow self) -> Self::Walker;
}
pub fn walker_once<'value, 'ctx: 'value, VisitorErr, W: WalkOnce<'value, 'ctx, VisitorErr>>(
@@ -60,8 +63,8 @@ pub fn walker_mut<'value, 'ctx: 'value, VisitorErr, W: WalkMut<'value, 'ctx, Vis
value.walker_mut()
}
-pub fn walker<'value, 'ctx: 'value, VisitorErr, W: Walk<'value, 'ctx, VisitorErr>>(
- value: &'value W,
-) -> W::Walker {
- value.walker()
-}
+// pub fn walker<'value, 'ctx: 'value, 'root: 'ctx, VisitorErr, W: Walk<'value, 'ctx, 'root, VisitorErr>>(
+// value: &'value W,
+// ) -> W::Walker {
+// value.walker()
+// }