Struct peresil::StringPoint
[−]
[src]
pub struct StringPoint<'a> { pub s: &'a str, pub offset: usize, }
Tracks the location of parsing in a string, the most common case.
Helper methods are provided to do basic parsing tasks, such as finding literal strings.
Fields
s: &'a str
The portion of the input string to start parsing next
offset: usize
How far into the original string we are
Methods
impl<'a> StringPoint<'a>
[src]
fn new(s: &'a str) -> StringPoint<'a>
fn to(self, other: StringPoint<'a>) -> &'a str
Slices the string.
fn consume_to(&self, l: Option<usize>) -> Progress<StringPoint<'a>, &'a str, ()>
Advances the point by the number of bytes. If the value is
None
, then no value was able to be consumed, and the result
is a failure.
fn consume_literal(self, val: &str) -> Progress<StringPoint<'a>, &'a str, ()>
Advances the point if it starts with the literal.
fn consume_identifier<T>(self, identifiers: &[Identifier<T>]) -> Progress<StringPoint<'a>, T, ()> where T: Clone
Iterates through the identifiers and advances the point on the first matching identifier.
Trait Implementations
impl<'a> Eq for StringPoint<'a>
[src]
impl<'a> PartialEq for StringPoint<'a>
[src]
fn eq(&self, __arg_0: &StringPoint<'a>) -> bool
This method tests for self
and other
values to be equal, and is used by ==
. Read more
fn ne(&self, __arg_0: &StringPoint<'a>) -> bool
This method tests for !=
.
impl<'a> Clone for StringPoint<'a>
[src]
fn clone(&self) -> StringPoint<'a>
Returns a copy of the value. Read more
fn clone_from(&mut self, source: &Self)
1.0.0
Performs copy-assignment from source
. Read more
impl<'a> Copy for StringPoint<'a>
[src]
impl<'a> Debug for StringPoint<'a>
[src]
impl<'a> PartialOrd for StringPoint<'a>
[src]
fn partial_cmp(&self, other: &StringPoint<'a>) -> Option<Ordering>
This method returns an ordering between self
and other
values if one exists. Read more
fn lt(&self, other: &Rhs) -> bool
1.0.0
This method tests less than (for self
and other
) and is used by the <
operator. Read more
fn le(&self, other: &Rhs) -> bool
1.0.0
This method tests less than or equal to (for self
and other
) and is used by the <=
operator. Read more
fn gt(&self, other: &Rhs) -> bool
1.0.0
This method tests greater than (for self
and other
) and is used by the >
operator. Read more
fn ge(&self, other: &Rhs) -> bool
1.0.0
This method tests greater than or equal to (for self
and other
) and is used by the >=
operator. Read more
impl<'a> Ord for StringPoint<'a>
[src]
fn cmp(&self, other: &StringPoint<'a>) -> Ordering
This method returns an Ordering
between self
and other
. Read more
impl<'a> Point for StringPoint<'a>
[src]
fn zero() -> StringPoint<'a>
The initial point