Skip to main content

TextParserUtils

Trait TextParserUtils 

Source
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§

Source

fn check_next(&mut self, ch: impl CharMatcher) -> bool

Checks if the next character matches the given character matcher

Source

fn consume_if(&mut self, ch: impl CharMatcher) -> bool

Consumes the next character if it matches the given character matcher

Source

fn read_while(&mut self, f: impl CharMatcher) -> Result<String>

Consumes characters while they match the given character matcher. returns the consumed text

Source

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.

Implementors§