Trait Parse

Source
pub trait Parse<'a, Input = &'a str>: Sized {
    type Output;
    type Error;

    // Required method
    fn parse(
        &self,
        input: Input,
    ) -> Result<(Self::Output, &'a str), Self::Error>;

    // Provided method
    fn parse_as_component(
        &self,
        input: Input,
    ) -> Result<Option<(Self::Output, &'a str)>, <Self::Error as IntoSkipOrFatal>::Fatal>
       where Self::Error: IntoSkipOrFatal { ... }
}
Expand description

Parse a segment.

Required Associated Types§

Required Methods§

Source

fn parse(&self, input: Input) -> Result<(Self::Output, &'a str), Self::Error>

Provided Methods§

Source

fn parse_as_component( &self, input: Input, ) -> Result<Option<(Self::Output, &'a str)>, <Self::Error as IntoSkipOrFatal>::Fatal>
where Self::Error: IntoSkipOrFatal,

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> Parse<'a, ComponentParserInput<'a>> for lazy_template::enclosed::simple_escape::Parser

Source§

impl<'a> Parse<'a, ComponentParserInput<'a>> for lazy_template::enclosed::simple_query::Parser

Source§

impl<'a, EscapeParser, QueryParser> Parse<'a> for lazy_template::enclosed::Parser<EscapeParser, QueryParser>
where EscapeParser: Parse<'a, ComponentParserInput<'a>, Output = char>, EscapeParser::Error: IntoSkipOrFatal, QueryParser: Parse<'a, ComponentParserInput<'a>>, QueryParser::Error: IntoSkipOrFatal,

Source§

type Output = Segment<<QueryParser as Parse<'a, ComponentParserInput<'a>>>::Output>

Source§

type Error = ParseError<<<EscapeParser as Parse<'a, ComponentParserInput<'a>>>::Error as IntoSkipOrFatal>::Fatal, <<QueryParser as Parse<'a, ComponentParserInput<'a>>>::Error as IntoSkipOrFatal>::Fatal>