pub trait TextParserUtils: PeekerTrait {
// Required methods
fn check_next(&mut self, ch: impl CharMatcher) -> bool;
fn consume_if(&mut self, ch: impl CharMatcher) -> bool;
fn read_while(&mut self, f: impl CharMatcher) -> Result<String>;
fn consume_while(&mut self, f: impl CharMatcher) -> Result<usize>;
}Expand description
The trait defining useful methods for text pasing The trait is automatically implemented for all types implementing its super trait
Required Methods§
Sourcefn check_next(&mut self, ch: impl CharMatcher) -> bool
fn check_next(&mut self, ch: impl CharMatcher) -> bool
Checks if the next character matches the given character matcher
Sourcefn consume_if(&mut self, ch: impl CharMatcher) -> bool
fn consume_if(&mut self, ch: impl CharMatcher) -> bool
Consumes the next character if it matches the given character matcher
Sourcefn read_while(&mut self, f: impl CharMatcher) -> Result<String>
fn read_while(&mut self, f: impl CharMatcher) -> Result<String>
Consumes characters while they match the given character matcher. returns the consumed text
Sourcefn consume_while(&mut self, f: impl CharMatcher) -> Result<usize>
fn consume_while(&mut self, f: impl CharMatcher) -> Result<usize>
Consumes characters while they match the given character matcher returns the amount of characters consumed
Dyn Compatibility§
This trait is not dyn compatible.
In older versions of Rust, dyn compatibility was called "object safety", so this trait is not object safe.