Struct pest::StringInput
[−]
[src]
pub struct StringInput { // some fields omitted }
A struct
useful for matching in-memory String
s.
Examples
let mut input = StringInput::new("asdasdf"); assert!(input.matches("asd")); assert!(input.matches("asdf")); assert!(!input.matches("nope"));
Methods
impl StringInput
[src]
fn new(string: &str) -> StringInput
Creates a new StringInput
from a &str
.
Examples
let mut input = StringInput::new("asd"); assert_eq!(input.len(), 3);
Trait Implementations
impl Input for StringInput
[src]
fn len(&self) -> usize
Returns length of an Input
.
fn pos(&self) -> usize
Returns current position of an Input
.
fn set_pos(&mut self, pos: usize)
Set current position of an Input
.
fn matches(&mut self, string: &str) -> bool
Matches string
to an Input
, returns whether it matched, and advances the position with string.len()
in case it did. Read more