Skip to main content

AlwaysTool

Trait AlwaysTool 

Source
pub trait AlwaysTool<'a>: Tool<'a> {
    // Required method
    fn parse_always(&self, st: View<'a>) -> (Self::Data, usize, View<'a>);

    // Provided method
    fn parse_always_nodata(&self, st: View<'a>) -> ((), usize, View<'a>) { ... }
}
Expand description

A parsing tool that always match a prefix.

Any object implementing this trait must also implement the Tool trait and their implementation of the parse must be equivalent to Ok(self.parse_always(st)).

It is a good practice to set core::convert::Infallible (or ! when it will become stable) as Error, but it is not mandatory.

Required Methods§

Source

fn parse_always(&self, st: View<'a>) -> (Self::Data, usize, View<'a>)

The main parsing algorithm.

Provided Methods§

Source

fn parse_always_nodata(&self, st: View<'a>) -> ((), usize, View<'a>)

Automatically discards the generated data.

Implementations on Foreign Types§

Source§

impl<'a, T> AlwaysTool<'a> for &T
where T: AlwaysTool<'a> + ?Sized,

Source§

fn parse_always(&self, st: View<'a>) -> (Self::Data, usize, View<'a>)

Implementors§

Source§

impl<'a> AlwaysTool<'a> for WhiteSP

Source§

impl<'a> AlwaysTool<'a> for TrueTool

Source§

impl<'a, F, S> AlwaysTool<'a> for Or<F, S>
where F: AlwaysTool<'a>, S: Tool<'a>,

Source§

impl<'a, F, S> AlwaysTool<'a> for Seq<F, S>
where F: AlwaysTool<'a>, S: AlwaysTool<'a>,

Source§

impl<'a, T, D, E, FD, FE> AlwaysTool<'a> for MapTool<T, FD, FE>
where T: AlwaysTool<'a>, FD: Fn(T::Data) -> D, FE: Fn(T::Error) -> E,

Source§

impl<'a, T, E> AlwaysTool<'a> for SetError<T, E>
where T: AlwaysTool<'a>,

Source§

impl<'a, T, SEP> AlwaysTool<'a> for RepeatAny<T, SEP>
where T: Tool<'a>, SEP: Tool<'a>,

Source§

impl<'a, T, SEP> AlwaysTool<'a> for VecStore<RepeatAny<T, SEP>>
where T: Tool<'a>, SEP: Tool<'a>,

Available on crate feature alloc only.