Skip to main content

Separator

Trait Separator 

Source
pub trait Separator {
    // Required methods
    fn separator() -> &'static str;
    fn parse<'i, F, T, E>(
        parser: &mut Parser<'i>,
        parse_one: F,
    ) -> Result<Vec<T>, ParseError<E>>
       where F: FnMut(&mut Parser<'i>) -> Result<T, ParseError<E>>;
}
Expand description

A trait satisfied by the types corresponding to separators.

Required Methods§

Source

fn separator() -> &'static str

The separator string that the satisfying separator type corresponds to.

Source

fn parse<'i, F, T, E>( parser: &mut Parser<'i>, parse_one: F, ) -> Result<Vec<T>, ParseError<E>>
where F: FnMut(&mut Parser<'i>) -> Result<T, ParseError<E>>,

Parses a sequence of values separated by this separator.

The given closure is called repeatedly for each item in the sequence.

Successful results are accumulated in a vector.

This method returns Err(_) the first time a closure does or if the separators aren’t correct.

Dyn Compatibility§

This trait is not dyn compatible.

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

Implementors§