Struct pest::inputs::StrInput
[−]
[src]
pub struct StrInput<'a> { /* fields omitted */ }
A struct
useful for matching borrowed str
s.
Methods
impl<'a> StrInput<'a>
[src]
fn new(source: &'a str) -> StrInput<'a>
[src]
Creates a new StrInput
from a &str
.
Examples
let input = StrInput::new("asd"); assert_eq!(input.len(), 3);
Trait Implementations
impl<'a> Clone for StrInput<'a>
[src]
fn clone(&self) -> StrInput<'a>
[src]
Returns a copy of the value. Read more
fn clone_from(&mut self, source: &Self)
1.0.0[src]
Performs copy-assignment from source
. Read more
impl<'a> Debug for StrInput<'a>
[src]
impl<'a> Eq for StrInput<'a>
[src]
impl<'a> Hash for StrInput<'a>
[src]
fn hash<__H: Hasher>(&self, __arg_0: &mut __H)
[src]
Feeds this value into the given [Hasher
]. Read more
fn hash_slice<H>(data: &[Self], state: &mut H) where
H: Hasher,
1.3.0[src]
H: Hasher,
Feeds a slice of this type into the given [Hasher
]. Read more
impl<'a> PartialEq for StrInput<'a>
[src]
fn eq(&self, __arg_0: &StrInput<'a>) -> bool
[src]
This method tests for self
and other
values to be equal, and is used by ==
. Read more
fn ne(&self, __arg_0: &StrInput<'a>) -> bool
[src]
This method tests for !=
.
impl<'a> Input for StrInput<'a>
[src]
fn len(&self) -> usize
[src]
Returns length of the input.
fn is_empty(&self) -> bool
[src]
Returns whether the input is empty.
fn file_name(&self) -> Option<OsString>
[src]
Returns the file name of the input or None
in the case where it doesn't have one.
unsafe fn slice(&self, start: usize, end: usize) -> &str
[src]
Slices the input. Read more
unsafe fn line_col(&self, pos: usize) -> (usize, usize)
[src]
Returns the line - and column number of the input at pos
. Read more
unsafe fn line_of(&self, pos: usize) -> &str
[src]
Returns the line of the input at pos
. Read more
unsafe fn skip(&self, n: usize, pos: usize) -> Option<usize>
[src]
Tries to skip n
char
s at pos
. Returns Some(len)
with the UTF-8 length of the skipped char
s position or None
if there are not enough char
s left to skip. Read more
unsafe fn match_string(&self, string: &str, pos: usize) -> bool
[src]
Matches string
at pos
and returns whether it matched. Read more
unsafe fn match_insensitive(&self, string: &str, pos: usize) -> bool
[src]
Matches string
at pos
case insensitively and returns whether it matched. Read more
unsafe fn match_range(&self, range: Range<char>, pos: usize) -> Option<usize>
[src]
Matches if the char
is within the range
and returns Some(len)
with the matching char
's UTF-8 length if it matched or None
otherwise. Read more