style_traits::values

Trait Separator

Source
pub trait Separator {
    // Required methods
    fn separator() -> &'static str;
    fn parse<'i, 't, F, T, E>(
        parser: &mut Parser<'i, 't>,
        parse_one: F,
    ) -> Result<Vec<T>, ParseError<'i, E>>
       where F: for<'tt> FnMut(&mut Parser<'i, 'tt>) -> Result<T, ParseError<'i, 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, 't, F, T, E>( parser: &mut Parser<'i, 't>, parse_one: F, ) -> Result<Vec<T>, ParseError<'i, E>>
where F: for<'tt> FnMut(&mut Parser<'i, 'tt>) -> Result<T, ParseError<'i, 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", so this trait is not object safe.

Implementors§