Skip to main content

Parser

Trait Parser 

Source
pub trait Parser: Send + Sync {
    // Required methods
    fn output(&self) -> TreeKind;
    fn parse<'a>(
        &self,
        input: &'a str,
        file: &mut File,
        alloc: &'a Allocator,
    ) -> Result<Tree<'a>, Error>;

    // Provided method
    fn source<'a>(&self, input: &'a str) -> &'a str { ... }
}
Expand description

Turns input text into a tree.

Required Methods§

Source

fn output(&self) -> TreeKind

Source

fn parse<'a>( &self, input: &'a str, file: &mut File, alloc: &'a Allocator, ) -> Result<Tree<'a>, Error>

Provided Methods§

Source

fn source<'a>(&self, input: &'a str) -> &'a str

The part of input the parser reads and positions count from: all of it by default.

Dyn Compatibility§

This trait is dyn compatible.

In older versions of Rust, dyn compatibility was called "object safety".

Implementors§