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§
Sourcefn record_err(
&mut self,
token_start: &Self::Checkpoint,
err_start: &Self::Checkpoint,
err: ErrMode<E>,
) -> Result<(), ErrMode<E>>
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
).
Sourcefn is_recovery_supported() -> bool
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]
impl<'a, T, E> Recover<E> for &'a [T]
Source§fn is_recovery_supported() -> bool
fn is_recovery_supported() -> bool
Report whether the Stream
can save off errors for recovery
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
impl<E> Recover<E> for &str
Source§fn is_recovery_supported() -> bool
fn is_recovery_supported() -> bool
Report whether the Stream
can save off errors for recovery
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)
impl<I, E> Recover<E> for (I, usize)
Source§fn is_recovery_supported() -> bool
fn is_recovery_supported() -> bool
Report whether the Stream
can save off errors for recovery