Skip to main content

TextParserTrait

Trait TextParserTrait 

Source
pub trait TextParserTrait {
    // Required methods
    fn position(&self) -> usize;
    fn get(&mut self, offset: usize) -> Option<Result<char>>;
    fn consume(&mut self, count: usize);
    fn peeker(&mut self) -> impl PeekerTrait;
}
Expand description

The trait for the text parser

Can be used to create a custom implementation of the TextParser struct

Required Methods§

Source

fn position(&self) -> usize

Get the current character position of the parser

Source

fn get(&mut self, offset: usize) -> Option<Result<char>>

Get the character at the given offset from the current position

Source

fn consume(&mut self, count: usize)

Consume the given number of characters

Source

fn peeker(&mut self) -> impl PeekerTrait

Create a peeker that uses the current parser

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§