Skip to main content

ParserTrait

Trait ParserTrait 

Source
pub trait ParserTrait<'input> {
    // Required methods
    fn peek(&mut self) -> Option<Result<&(Event<'input>, Span), ScanError>>;
    fn next_event(&mut self) -> Option<Result<(Event<'input>, Span), ScanError>>;
    fn load<R: SpannedEventReceiver<'input>>(
        &mut self,
        recv: &mut R,
        multi: bool,
    ) -> Result<(), ScanError>;
}
Expand description

Trait extracted from Parser to support mocking and alternative implementations.

Required Methods§

Source

fn peek(&mut self) -> Option<Result<&(Event<'input>, Span), ScanError>>

Try to load the next event and return it, but do not consuming it from self.

Source

fn next_event(&mut self) -> Option<Result<(Event<'input>, Span), ScanError>>

Try to load the next event and return it, consuming it from self.

Source

fn load<R: SpannedEventReceiver<'input>>( &mut self, recv: &mut R, multi: bool, ) -> Result<(), ScanError>

Load the YAML from the stream in self, pushing events into recv.

§Errors

Returns ScanError when scanning or parsing the stream fails.

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<'input> ParserTrait<'input> for ReplayParser<'input>

Source§

impl<'input, I, T> ParserTrait<'input> for ParserStack<'input, I, T>
where I: Iterator<Item = char>, T: BorrowedInput<'input>,

Source§

impl<'input, T: BorrowedInput<'input>> ParserTrait<'input> for Parser<'input, T>