pub struct StreamParser<'a> { /* private fields */ }Implementations§
Source§impl<'a> StreamParser<'a>
impl<'a> StreamParser<'a>
pub fn new<T: AsRef<Path>>(file_path: T, value: &'a str) -> Self
Sourcepub fn peek_exact(&self, val: &str) -> bool
pub fn peek_exact(&self, val: &str) -> bool
Returns if the next bytes match the provided value.
If EOI is reached, false is returned.
Sourcepub fn peek_early(&self, n: usize, e: usize) -> Result<&'a str>
pub fn peek_early(&self, n: usize, e: usize) -> Result<&'a str>
Peek the next n bytes starting at e bytes from the current index.
§Errors
Returns an error if EOI is found.
Sourcepub fn peek_early_exact(&self, val: &str, e: usize) -> bool
pub fn peek_early_exact(&self, val: &str, e: usize) -> bool
Returns if the next bytes starting at e from the current index match the provided value.
If EOI is reached, false is returned.
Sourcepub fn take_exact(&mut self, val: &str) -> Result<()>
pub fn take_exact(&mut self, val: &str) -> Result<()>
Check if the next characters match the value. If the values match, advance the current index of the length of the value and return true, otherwise return false.
§Errors
Returns an error if EOI is found or if the next characters does not match the string given as argument.
Sourcepub fn trim(&mut self)
pub fn trim(&mut self)
Advance the string so that the index will point to a non-space character.
pub fn is_eoi(&self) -> bool
pub fn take_while<F: FnMut((usize, char)) -> bool>(&mut self, f: F) -> &'a str
pub fn take_while_peekable<F: FnMut(usize, char, Option<char>) -> bool>( &mut self, f: F, ) -> &'a str
Sourcepub fn take_until(&mut self, val: &str) -> Result<&'a str>
pub fn take_until(&mut self, val: &str) -> Result<&'a str>
Take all the data until val is found.
Returns the data taken.
§Errors
Returns an error if EOI is found.
Sourcepub fn take_until_index(&mut self, val: &str) -> Result<usize>
pub fn take_until_index(&mut self, val: &str) -> Result<usize>
Take all the data until val is found.
Returns the index of the first character of val in the data.
§Errors
Returns an error if EOI is found.
pub fn take_until_eoi(&mut self) -> &'a str
Trait Implementations§
Source§impl<'a> Clone for StreamParser<'a>
impl<'a> Clone for StreamParser<'a>
Source§fn clone(&self) -> StreamParser<'a>
fn clone(&self) -> StreamParser<'a>
1.0.0 (const: unstable) · Source§fn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
source. Read more