winnow::stream

Trait Recover

Source
pub trait Recover<E>: Stream {
    // Required methods
    fn record_err(
        &mut self,
        token_start: &Self::Checkpoint,
        err_start: &Self::Checkpoint,
        err: ErrMode<E>,
    ) -> Result<(), ErrMode<E>>;
    fn is_recovery_supported() -> bool;
}
Available on crate features unstable-recover and std only.
Expand description

Capture top-level errors in the middle of parsing so parsing can resume

See Recoverable for adding error recovery tracking to your Stream

Required Methods§

Source

fn record_err( &mut self, token_start: &Self::Checkpoint, err_start: &Self::Checkpoint, err: ErrMode<E>, ) -> Result<(), ErrMode<E>>

Capture a top-level error

May return Err(err) if recovery is not possible (e.g. if Recover::is_recovery_supported returns false).

Source

fn is_recovery_supported() -> bool

Report whether the Stream can save off errors for recovery

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.

Implementations on Foreign Types§

Source§

impl<'a, T, E> Recover<E> for &'a [T]
where &'a [T]: Stream,

Source§

fn is_recovery_supported() -> bool

Report whether the Stream can save off errors for recovery

Source§

fn record_err( &mut self, _token_start: &Self::Checkpoint, _err_start: &Self::Checkpoint, err: ErrMode<E>, ) -> Result<(), ErrMode<E>>

Source§

impl<E> Recover<E> for &str

Source§

fn is_recovery_supported() -> bool

Report whether the Stream can save off errors for recovery

Source§

fn record_err( &mut self, _token_start: &Self::Checkpoint, _err_start: &Self::Checkpoint, err: ErrMode<E>, ) -> Result<(), ErrMode<E>>

Source§

impl<I, E> Recover<E> for (I, usize)
where I: Recover<E> + Stream<Token = u8> + Clone,

Source§

fn is_recovery_supported() -> bool

Report whether the Stream can save off errors for recovery

Source§

fn record_err( &mut self, _token_start: &Self::Checkpoint, _err_start: &Self::Checkpoint, err: ErrMode<E>, ) -> Result<(), ErrMode<E>>

Implementors§

Source§

impl<E> Recover<E> for &BStr

Source§

impl<E> Recover<E> for &Bytes

Source§

impl<I, E> Recover<E> for LocatingSlice<I>
where I: Recover<E> + Stream,

Source§

impl<I, E> Recover<E> for Partial<I>
where I: Recover<E> + Stream,

Source§

impl<I, E, R> Recover<E> for Recoverable<I, R>
where I: Stream, R: FromRecoverableError<Self, E> + Debug,

Source§

impl<I, E, S> Recover<E> for Stateful<I, S>
where I: Recover<E> + Stream, S: Clone + Debug,