pub struct Recoverable<I, E>where
I: Stream,{ /* private fields */ }Available on crate features
unstable-recover and std only.Expand description
Allow recovering from parse errors, capturing them as the parser continues
Generally, this will be used indirectly via
RecoverableParser::recoverable_parse.
Implementations§
Source§impl<I, E> Recoverable<I, E>where
I: Stream,
impl<I, E> Recoverable<I, E>where
I: Stream,
Sourcepub fn unrecoverable(input: I) -> Self
pub fn unrecoverable(input: I) -> Self
Act as a normal stream
Sourcepub fn into_parts(self) -> (I, Vec<E>)
pub fn into_parts(self) -> (I, Vec<E>)
Access the current input and errors
Trait Implementations§
Source§impl<I, E> AsBStr for Recoverable<I, E>
impl<I, E> AsBStr for Recoverable<I, E>
Source§impl<I, E> AsBytes for Recoverable<I, E>
impl<I, E> AsBytes for Recoverable<I, E>
Source§impl<I, E> AsRef<I> for Recoverable<I, E>where
I: Stream,
impl<I, E> AsRef<I> for Recoverable<I, E>where
I: Stream,
Source§impl<I, E: Clone> Clone for Recoverable<I, E>
impl<I, E: Clone> Clone for Recoverable<I, E>
Source§fn clone(&self) -> Recoverable<I, E>
fn clone(&self) -> Recoverable<I, E>
Returns a duplicate of the value. Read more
1.0.0 · Source§fn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
Performs copy-assignment from
source. Read moreSource§impl<I, E, U> Compare<U> for Recoverable<I, E>
impl<I, E, U> Compare<U> for Recoverable<I, E>
Source§fn compare(&self, other: U) -> CompareResult
fn compare(&self, other: U) -> CompareResult
Compares self to another value for equality
Source§impl<I, E: Debug> Debug for Recoverable<I, E>
impl<I, E: Debug> Debug for Recoverable<I, E>
Source§impl<I, E> Default for Recoverable<I, E>
impl<I, E> Default for Recoverable<I, E>
Source§impl<I, E> Deref for Recoverable<I, E>where
I: Stream,
impl<I, E> Deref for Recoverable<I, E>where
I: Stream,
Source§impl<I, E> Display for Recoverable<I, E>
impl<I, E> Display for Recoverable<I, E>
Source§impl<I, E, T> FindSlice<T> for Recoverable<I, E>
impl<I, E, T> FindSlice<T> for Recoverable<I, E>
Source§impl<I, E> Location for Recoverable<I, E>
impl<I, E> Location for Recoverable<I, E>
Source§fn previous_token_end(&self) -> usize
fn previous_token_end(&self) -> usize
Previous token’s end offset
Source§fn current_token_start(&self) -> usize
fn current_token_start(&self) -> usize
Current token’s start offset
Source§impl<I, E> Offset<<Recoverable<I, E> as Stream>::Checkpoint> for Recoverable<I, E>
impl<I, E> Offset<<Recoverable<I, E> as Stream>::Checkpoint> for Recoverable<I, E>
Source§fn offset_from(
&self,
other: &<Recoverable<I, E> as Stream>::Checkpoint,
) -> usize
fn offset_from( &self, other: &<Recoverable<I, E> as Stream>::Checkpoint, ) -> usize
Source§impl<I, E> Offset for Recoverable<I, E>
impl<I, E> Offset for Recoverable<I, E>
Source§fn offset_from(&self, other: &Self) -> usize
fn offset_from(&self, other: &Self) -> usize
Source§impl<I, E, R> Recover<E> for Recoverable<I, R>
impl<I, E, R> Recover<E> for Recoverable<I, R>
Source§fn is_recovery_supported() -> bool
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: E,
) -> Result<(), E>
fn record_err( &mut self, token_start: &Self::Checkpoint, err_start: &Self::Checkpoint, err: E, ) -> Result<(), E>
Capture a top-level error Read more
Source§impl<I, E> SliceLen for Recoverable<I, E>
impl<I, E> SliceLen for Recoverable<I, E>
Source§impl<I, E: Debug> Stream for Recoverable<I, E>where
I: Stream,
impl<I, E: Debug> Stream for Recoverable<I, E>where
I: Stream,
Source§type IterOffsets = <I as Stream>::IterOffsets
type IterOffsets = <I as Stream>::IterOffsets
Iterate with the offset from the current location
Source§type Checkpoint = Checkpoint<<I as Stream>::Checkpoint, Recoverable<I, E>>
type Checkpoint = Checkpoint<<I as Stream>::Checkpoint, Recoverable<I, E>>
A parse location within the stream
Source§fn iter_offsets(&self) -> Self::IterOffsets
fn iter_offsets(&self) -> Self::IterOffsets
Iterate with the offset from the current location
Source§fn eof_offset(&self) -> usize
fn eof_offset(&self) -> usize
Returns the offset to the end of the input
Source§fn next_token(&mut self) -> Option<Self::Token>
fn next_token(&mut self) -> Option<Self::Token>
Split off the next token from the input
Source§fn peek_token(&self) -> Option<Self::Token>
fn peek_token(&self) -> Option<Self::Token>
Split off the next token from the input
Source§fn offset_for<P>(&self, predicate: P) -> Option<usize>
fn offset_for<P>(&self, predicate: P) -> Option<usize>
Finds the offset of the next matching token
Source§fn offset_at(&self, tokens: usize) -> Result<usize, Needed>
fn offset_at(&self, tokens: usize) -> Result<usize, Needed>
Get the offset for the number of
tokens into the stream Read moreSource§fn next_slice(&mut self, offset: usize) -> Self::Slice
fn next_slice(&mut self, offset: usize) -> Self::Slice
Split off a slice of tokens from the input Read more
Source§unsafe fn next_slice_unchecked(&mut self, offset: usize) -> Self::Slice
unsafe fn next_slice_unchecked(&mut self, offset: usize) -> Self::Slice
Split off a slice of tokens from the input Read more
Source§fn peek_slice(&self, offset: usize) -> Self::Slice
fn peek_slice(&self, offset: usize) -> Self::Slice
Split off a slice of tokens from the input
Source§unsafe fn peek_slice_unchecked(&self, offset: usize) -> Self::Slice
unsafe fn peek_slice_unchecked(&self, offset: usize) -> Self::Slice
Split off a slice of tokens from the input Read more
Source§fn checkpoint(&self) -> Self::Checkpoint
fn checkpoint(&self) -> Self::Checkpoint
Save the current parse location within the stream
Source§fn reset(&mut self, checkpoint: &Self::Checkpoint)
fn reset(&mut self, checkpoint: &Self::Checkpoint)
Revert the stream to a prior
Self::Checkpoint Read moreSource§fn raw(&self) -> &dyn Debug
fn raw(&self) -> &dyn Debug
👎Deprecated since 0.7.10: Replaced with
Stream::traceDeprecated for callers as of 0.7.10, instead call
Stream::traceSource§fn peek_finish(&self) -> Self::Slicewhere
Self: Clone,
fn peek_finish(&self) -> Self::Slicewhere
Self: Clone,
Advance to the end of the stream
Source§impl<I, E> StreamIsPartial for Recoverable<I, E>where
I: StreamIsPartial + Stream,
impl<I, E> StreamIsPartial for Recoverable<I, E>where
I: StreamIsPartial + Stream,
Source§type PartialState = <I as StreamIsPartial>::PartialState
type PartialState = <I as StreamIsPartial>::PartialState
Whether the stream is currently partial or complete
Source§fn complete(&mut self) -> Self::PartialState
fn complete(&mut self) -> Self::PartialState
Mark the stream is complete
Source§fn restore_partial(&mut self, state: Self::PartialState)
fn restore_partial(&mut self, state: Self::PartialState)
Restore the stream back to its previous state
Source§fn is_partial_supported() -> bool
fn is_partial_supported() -> bool
Report whether the
Stream is can ever be incompleteSource§fn is_partial(&self) -> bool
fn is_partial(&self) -> bool
Report whether the
Stream is currently incompleteSource§impl<I, E> UpdateSlice for Recoverable<I, E>
impl<I, E> UpdateSlice for Recoverable<I, E>
Source§fn update_slice(self, inner: Self::Slice) -> Self
fn update_slice(self, inner: Self::Slice) -> Self
Convert an
Output type to be used as StreamAuto Trait Implementations§
impl<I, E> Freeze for Recoverable<I, E>where
I: Freeze,
impl<I, E> RefUnwindSafe for Recoverable<I, E>where
I: RefUnwindSafe,
E: RefUnwindSafe,
impl<I, E> Send for Recoverable<I, E>
impl<I, E> Sync for Recoverable<I, E>
impl<I, E> Unpin for Recoverable<I, E>
impl<I, E> UnwindSafe for Recoverable<I, E>where
I: UnwindSafe,
E: UnwindSafe,
Blanket Implementations§
Source§impl<T> BorrowMut<T> for Twhere
T: ?Sized,
impl<T> BorrowMut<T> for Twhere
T: ?Sized,
Source§fn borrow_mut(&mut self) -> &mut T
fn borrow_mut(&mut self) -> &mut T
Mutably borrows from an owned value. Read more