Trait ParseSource

Source
pub trait ParseSource<'a>: 'a {
    type Pos: SourcePos;
    type Str: StringOrStr<'a>;
    type Source;

Show 13 methods // Required methods fn source(&self) -> &Self::Source; fn curr_pos(&self) -> Self::Pos; fn pop_head(&mut self) -> Option<char>; fn read_until_line_end(&mut self) -> (Self::Str, Self::Pos); fn trim_start(&mut self); fn starts_with(&mut self, c: char) -> bool; fn peek_head(&mut self) -> Option<char>; fn read_n(&mut self, i: usize) -> Self::Str; fn read_while(&mut self, pred: impl FnMut(char) -> bool) -> Self::Str; fn read_until_str(&mut self, s: &str) -> Self::Str; fn read_until_with_brackets<const OPEN: char, const CLOSE: char>( &mut self, pred: impl FnMut(char) -> bool, ) -> Self::Str; fn skip(&mut self, i: usize); // Provided method fn read_until(&mut self, pred: impl FnMut(char) -> bool) -> Self::Str { ... }
}

Required Associated Typesยง

Required Methodsยง

Source

fn source(&self) -> &Self::Source

Source

fn curr_pos(&self) -> Self::Pos

Source

fn pop_head(&mut self) -> Option<char>

Source

fn read_until_line_end(&mut self) -> (Self::Str, Self::Pos)

Source

fn trim_start(&mut self)

Source

fn starts_with(&mut self, c: char) -> bool

Source

fn peek_head(&mut self) -> Option<char>

Source

fn read_n(&mut self, i: usize) -> Self::Str

Source

fn read_while(&mut self, pred: impl FnMut(char) -> bool) -> Self::Str

Source

fn read_until_str(&mut self, s: &str) -> Self::Str

Source

fn read_until_with_brackets<const OPEN: char, const CLOSE: char>( &mut self, pred: impl FnMut(char) -> bool, ) -> Self::Str

Source

fn skip(&mut self, i: usize)

Provided Methodsยง

Source

fn read_until(&mut self, pred: impl FnMut(char) -> bool) -> Self::Str

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ยง

Sourceยง

impl<'a, P: SourcePos + 'a> ParseSource<'a> for ParseStr<'a, P>

Sourceยง

impl<'a, R: Read + 'a, P: SourcePos + 'a> ParseSource<'a> for ParseReader<R, P>