pub struct Span<'i> { /* fields omitted */ }Returns the Span's start byte position as a usize.
let input = "ab";
let start = Position::from_start(input);
let end = start.clone();
let span = start.span(&end);
assert_eq!(span.start(), 0);
Returns the Span's end byte position as a usize.
let input = "ab";
let start = Position::from_start(input);
let end = start.clone();
let span = start.span(&end);
assert_eq!(span.end(), 0);
Returns the Span's start Position.
let input = "ab";
let start = Position::from_start(input);
let end = start.clone();
let span = start.clone().span(&end);
assert_eq!(span.start_pos(), start);
Returns the Span's end Position.
let input = "ab";
let start = Position::from_start(input);
let end = start.clone();
let span = start.span(&end);
assert_eq!(span.end_pos(), end);
Splits the Span into a pair of Positions.
let input = "ab";
let start = Position::from_start(input);
let end = start.clone();
let span = start.clone().span(&end);
assert_eq!(span.split(), (start, end));
Captures a slice from the &str defined by the Span.
enum Rule {}
let input = "abc";
let mut state: Box<pest::ParserState<Rule>> = pest::ParserState::new(input).skip(1).unwrap();
let start_pos = state.position().clone();
state = state.match_string("b").unwrap();
let span = start_pos.span(&state.position().clone());
assert_eq!(span.as_str(), "b");
Formats the value using the given formatter. Read more
Performs copy-assignment from source. Read more
This method tests for self and other values to be equal, and is used by ==. Read more
This method tests for !=.
Feeds this value into the given [Hasher]. Read more
Feeds a slice of this type into the given [Hasher]. Read more