Make StepCursor::advance private
diff --git a/src/group.rs b/src/group.rs
index 9eb005e..b2e4659 100644
--- a/src/group.rs
+++ b/src/group.rs
@@ -75,7 +75,8 @@
input.step(|cursor| {
if let Some((content, span, rest)) = cursor.group(delimiter) {
let unexpected = private::get_unexpected(input);
- let content = private::new_parse_buffer(span, cursor.advance(content), unexpected);
+ let nested = private::advance_step_cursor(cursor, content);
+ let content = private::new_parse_buffer(span, nested, unexpected);
Ok(((span, content), rest))
} else {
let message = match delimiter {
diff --git a/src/parse.rs b/src/parse.rs
index 3c62641..dfca478 100644
--- a/src/parse.rs
+++ b/src/parse.rs
@@ -221,17 +221,6 @@
}
impl<'c, 'a> StepCursor<'c, 'a> {
- /// Produces a cursor suitable for returning within the `R` return value of
- /// a `ParseStream::step` invocation.
- ///
- /// # Performance
- ///
- /// This method performs a very small fixed amount of work independent of
- /// the distance between `to` and the prior position of the stream.
- pub fn advance(self, to: Cursor<'c>) -> Cursor<'a> {
- unsafe { mem::transmute::<Cursor<'c>, Cursor<'a>>(to) }
- }
-
/// Triggers an error at the current position of the parse stream.
///
/// The `ParseStream::step` invocation will return this same error without
@@ -241,6 +230,13 @@
}
}
+impl private {
+ pub fn advance_step_cursor<'c, 'a>(proof: StepCursor<'c, 'a>, to: Cursor<'c>) -> Cursor<'a> {
+ let _ = proof;
+ unsafe { mem::transmute::<Cursor<'c>, Cursor<'a>>(to) }
+ }
+}
+
fn skip(input: ParseStream) -> bool {
input
.step(|cursor| {