pub(crate) struct ContextError<C = StrContext> {
context: Vec<C>,
cause: Option<Box<dyn Error + Sync + Send>>,
}
Expand description
Accumulate context while backtracking errors
Fields§
§context: Vec<C>
§cause: Option<Box<dyn Error + Sync + Send>>
Implementations§
source§impl<C> ContextError<C>
impl<C> ContextError<C>
sourcepub fn new() -> ContextError<C>
pub fn new() -> ContextError<C>
Create an empty error
sourcepub fn context(&self) -> impl Iterator<Item = &C>
pub fn context(&self) -> impl Iterator<Item = &C>
Access context from Parser::context
Trait Implementations§
source§impl<C, I> AddContext<I, C> for ContextError<C>where
I: Stream,
impl<C, I> AddContext<I, C> for ContextError<C>where
I: Stream,
source§fn add_context(
self,
_input: &I,
_token_start: &<I as Stream>::Checkpoint,
context: C,
) -> ContextError<C>
fn add_context( self, _input: &I, _token_start: &<I as Stream>::Checkpoint, context: C, ) -> ContextError<C>
Append to an existing error custom data Read more
source§impl<C> Clone for ContextError<C>where
C: Clone,
impl<C> Clone for ContextError<C>where
C: Clone,
source§fn clone(&self) -> ContextError<C>
fn clone(&self) -> ContextError<C>
Returns a copy 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<C> Debug for ContextError<C>where
C: Debug,
impl<C> Debug for ContextError<C>where
C: Debug,
source§impl<C> Default for ContextError<C>
impl<C> Default for ContextError<C>
source§fn default() -> ContextError<C>
fn default() -> ContextError<C>
Returns the “default value” for a type. Read more
source§impl Display for ContextError
impl Display for ContextError
source§impl<C> ErrorConvert<ContextError<C>> for ContextError<C>
impl<C> ErrorConvert<ContextError<C>> for ContextError<C>
source§fn convert(self) -> ContextError<C>
fn convert(self) -> ContextError<C>
Transform to another error type
source§impl<C, I, E> FromExternalError<I, E> for ContextError<C>
impl<C, I, E> FromExternalError<I, E> for ContextError<C>
source§fn from_external_error(_input: &I, _kind: ErrorKind, e: E) -> ContextError<C>
fn from_external_error(_input: &I, _kind: ErrorKind, e: E) -> ContextError<C>
Like
ParserError::from_error_kind
but also include an external error.source§impl<I, C> ParserError<I> for ContextError<C>where
I: Stream,
impl<I, C> ParserError<I> for ContextError<C>where
I: Stream,
source§fn from_error_kind(_input: &I, _kind: ErrorKind) -> ContextError<C>
fn from_error_kind(_input: &I, _kind: ErrorKind) -> ContextError<C>
Creates an error from the input position and an
ErrorKind
source§fn append(
self,
_input: &I,
_token_start: &<I as Stream>::Checkpoint,
_kind: ErrorKind,
) -> ContextError<C>
fn append( self, _input: &I, _token_start: &<I as Stream>::Checkpoint, _kind: ErrorKind, ) -> ContextError<C>
Like
ParserError::from_error_kind
but merges it with the existing error. Read moresource§fn or(self, other: ContextError<C>) -> ContextError<C>
fn or(self, other: ContextError<C>) -> ContextError<C>
Combines errors from two different parse branches. Read more
source§impl<C> PartialEq for ContextError<C>where
C: PartialEq,
impl<C> PartialEq for ContextError<C>where
C: PartialEq,
Auto Trait Implementations§
impl<C> Freeze for ContextError<C>
impl<C = StrContext> !RefUnwindSafe for ContextError<C>
impl<C> Send for ContextError<C>where
C: Send,
impl<C> Sync for ContextError<C>where
C: Sync,
impl<C> Unpin for ContextError<C>where
C: Unpin,
impl<C = StrContext> !UnwindSafe for ContextError<C>
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
source§impl<T> CloneToUninit for Twhere
T: Clone,
impl<T> CloneToUninit for Twhere
T: Clone,
source§unsafe fn clone_to_uninit(&self, dst: *mut T)
unsafe fn clone_to_uninit(&self, dst: *mut T)
🔬This is a nightly-only experimental API. (
clone_to_uninit
)