diff --git a/src/protocol/parser/tokens.rs b/src/protocol/parser/tokens.rs index 57c8c5d8f2a1a1ebf42033a780eb73cb5bad06d4..a3bbf37c46dbda95f6bbe3c037c16368639b61e3 100644 --- a/src/protocol/parser/tokens.rs +++ b/src/protocol/parser/tokens.rs @@ -329,4 +329,15 @@ impl<'a> TokenIter<'a> { } } } + + /// Saves the current iteration position, may be passed to `load` to return + /// the iterator to a previous position. + pub(crate) fn save(&self) -> (usize, usize) { + (self.cur, self.end) + } + + pub(crate) fn load(&mut self, saved: (usize, usize)) { + self.cur = saved.0; + self.end = saved.1; + } } \ No newline at end of file