Skip to main content

LiteralPrefix

Trait LiteralPrefix 

Source
pub trait LiteralPrefix: Sized + 'static {
    // Required methods
    fn strip_literal<'i>(&self, input: &'i [u8]) -> Option<&'i [u8]>;
    fn expected_one_of(literals: &'static [Self]) -> ParseError;
}
Expand description

Helper trait for rule literals in parser::parse_tree! scopes.

Required Methods§

Source

fn strip_literal<'i>(&self, input: &'i [u8]) -> Option<&'i [u8]>

Returns the remaining input if the input starts with this literal.

Source

fn expected_one_of(literals: &'static [Self]) -> ParseError

Returns a ParseError containing the expected literals.

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.

Implementations on Foreign Types§

Source§

impl LiteralPrefix for &'static str

Source§

fn strip_literal<'i>(&self, input: &'i [u8]) -> Option<&'i [u8]>

Source§

fn expected_one_of(literals: &'static [Self]) -> ParseError

Source§

impl LiteralPrefix for u8

Source§

fn strip_literal<'i>(&self, input: &'i [u8]) -> Option<&'i [u8]>

Source§

fn expected_one_of(literals: &'static [Self]) -> ParseError

Implementors§