Struct peresil::StringPoint [−][src]
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]
impl<'a> StringPoint<'a>
pub fn new(s: &'a str) -> StringPoint<'a>
[src]
pub fn new(s: &'a str) -> StringPoint<'a>
pub fn is_empty(self) -> bool
[src]
pub fn is_empty(self) -> bool
pub fn to(self, other: StringPoint<'a>) -> &'a str
[src]
pub fn to(self, other: StringPoint<'a>) -> &'a str
Slices the string.
pub fn success<E>(self, len: usize) -> Progress<StringPoint<'a>, &'a str, E>
[src]
pub fn success<E>(self, len: usize) -> Progress<StringPoint<'a>, &'a str, E>
pub fn consume_to(
&self,
l: Option<usize>
) -> Progress<StringPoint<'a>, &'a str, ()>
[src]
pub 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.
pub fn consume_literal(
self,
val: &str
) -> Progress<StringPoint<'a>, &'a str, ()>
[src]
pub fn consume_literal(
self,
val: &str
) -> Progress<StringPoint<'a>, &'a str, ()>
Advances the point if it starts with the literal.
pub fn consume_identifier<T>(
self,
identifiers: &[Identifier<T>]
) -> Progress<StringPoint<'a>, T, ()> where
T: Clone,
[src]
pub 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> Debug for StringPoint<'a>
[src]
impl<'a> Debug for StringPoint<'a>
fn fmt(&self, f: &mut Formatter) -> Result
[src]
fn fmt(&self, f: &mut Formatter) -> Result
Formats the value using the given formatter. Read more
impl<'a> Copy for StringPoint<'a>
[src]
impl<'a> Copy for StringPoint<'a>
impl<'a> Clone for StringPoint<'a>
[src]
impl<'a> Clone for StringPoint<'a>
fn clone(&self) -> 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[src]
fn clone_from(&mut self, source: &Self)
Performs copy-assignment from source
. Read more
impl<'a> PartialEq for StringPoint<'a>
[src]
impl<'a> PartialEq for StringPoint<'a>
fn eq(&self, other: &StringPoint<'a>) -> bool
[src]
fn eq(&self, other: &StringPoint<'a>) -> bool
This method tests for self
and other
values to be equal, and is used by ==
. Read more
fn ne(&self, other: &StringPoint<'a>) -> bool
[src]
fn ne(&self, other: &StringPoint<'a>) -> bool
This method tests for !=
.
impl<'a> Eq for StringPoint<'a>
[src]
impl<'a> Eq for StringPoint<'a>
impl<'a> PartialOrd for StringPoint<'a>
[src]
impl<'a> PartialOrd for StringPoint<'a>
fn partial_cmp(&self, other: &StringPoint<'a>) -> Option<Ordering>
[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[src]
fn lt(&self, other: &Rhs) -> bool
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[src]
fn le(&self, other: &Rhs) -> bool
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[src]
fn gt(&self, other: &Rhs) -> bool
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[src]
fn ge(&self, other: &Rhs) -> bool
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]
impl<'a> Ord for StringPoint<'a>
fn cmp(&self, other: &StringPoint<'a>) -> Ordering
[src]
fn cmp(&self, other: &StringPoint<'a>) -> Ordering
This method returns an Ordering
between self
and other
. Read more
fn max(self, other: Self) -> Self
1.21.0[src]
fn max(self, other: Self) -> Self
Compares and returns the maximum of two values. Read more
fn min(self, other: Self) -> Self
1.21.0[src]
fn min(self, other: Self) -> Self
Compares and returns the minimum of two values. Read more
impl<'a> Point for StringPoint<'a>
[src]
impl<'a> Point for StringPoint<'a>
fn zero() -> StringPoint<'a>
[src]
fn zero() -> StringPoint<'a>
The initial point
Auto Trait Implementations
impl<'a> Send for StringPoint<'a>
impl<'a> Send for StringPoint<'a>
impl<'a> Sync for StringPoint<'a>
impl<'a> Sync for StringPoint<'a>