pub struct InputError<I: Clone> {
pub input: I,
pub kind: ErrorKind,
}
Expand description
Capture input on error
This is useful for testing of generic parsers to ensure the error happens at the right location.
Note: context and inner errors (like from Parser::try_map
) will be
dropped.
Fields§
§input: I
The input stream, pointing to the location where the error occurred
kind: ErrorKind
A rudimentary error kind
Implementations§
Source§impl<I: Clone> InputError<I>
impl<I: Clone> InputError<I>
Source§impl<'i, I: ToOwned> InputError<&'i I>
impl<'i, I: ToOwned> InputError<&'i I>
Sourcepub fn into_owned(self) -> InputError<<I as ToOwned>::Owned>
pub fn into_owned(self) -> InputError<<I as ToOwned>::Owned>
Obtaining ownership
Trait Implementations§
Source§impl<I: Stream + Clone, C> AddContext<I, C> for InputError<I>
impl<I: Stream + Clone, C> AddContext<I, C> for InputError<I>
Source§fn add_context(
self,
_input: &I,
_token_start: &<I as Stream>::Checkpoint,
_context: C,
) -> Self
fn add_context( self, _input: &I, _token_start: &<I as Stream>::Checkpoint, _context: C, ) -> Self
Append to an existing error custom data Read more
Source§impl<I: Clone + Clone> Clone for InputError<I>
impl<I: Clone + Clone> Clone for InputError<I>
Source§fn clone(&self) -> InputError<I>
fn clone(&self) -> InputError<I>
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<I: Clone + Display> Display for InputError<I>
The Display implementation allows the std::error::Error
implementation
impl<I: Clone + Display> Display for InputError<I>
The Display implementation allows the std::error::Error
implementation
Source§impl<I: Clone + Debug + Display + Sync + Send + 'static> Error for InputError<I>
impl<I: Clone + Debug + Display + Sync + Send + 'static> Error for InputError<I>
1.30.0 · Source§fn source(&self) -> Option<&(dyn Error + 'static)>
fn source(&self) -> Option<&(dyn Error + 'static)>
Returns the lower-level source of this error, if any. Read more
1.0.0 · Source§fn description(&self) -> &str
fn description(&self) -> &str
👎Deprecated since 1.42.0: use the Display impl or to_string()
Source§impl<I: Clone> ErrorConvert<InputError<(I, usize)>> for InputError<I>
impl<I: Clone> ErrorConvert<InputError<(I, usize)>> for InputError<I>
Source§fn convert(self) -> InputError<(I, usize)>
fn convert(self) -> InputError<(I, usize)>
Transform to another error type
Source§impl<I: Clone> ErrorConvert<InputError<I>> for InputError<(I, usize)>
impl<I: Clone> ErrorConvert<InputError<I>> for InputError<(I, usize)>
Source§fn convert(self) -> InputError<I>
fn convert(self) -> InputError<I>
Transform to another error type
Source§impl<I: Clone, E> FromExternalError<I, E> for InputError<I>
impl<I: Clone, E> FromExternalError<I, E> for InputError<I>
Source§fn from_external_error(input: &I, kind: ErrorKind, _e: E) -> Self
fn from_external_error(input: &I, kind: ErrorKind, _e: E) -> Self
Create a new error from an input position and an external error
Source§impl<I: Stream + Clone> ParserError<I> for InputError<I>
impl<I: Stream + Clone> ParserError<I> for InputError<I>
Source§fn from_error_kind(input: &I, kind: ErrorKind) -> Self
fn from_error_kind(input: &I, kind: ErrorKind) -> Self
Creates an error from the input position and an
ErrorKind
Source§fn append(
self,
_input: &I,
_token_start: &<I as Stream>::Checkpoint,
_kind: ErrorKind,
) -> Self
fn append( self, _input: &I, _token_start: &<I as Stream>::Checkpoint, _kind: ErrorKind, ) -> Self
Like
ParserError::from_error_kind
but merges it with the existing error. Read moreimpl<I: Copy + Clone> Copy for InputError<I>
impl<I: Eq + Clone> Eq for InputError<I>
impl<I: Clone> StructuralPartialEq for InputError<I>
Auto Trait Implementations§
impl<I> Freeze for InputError<I>where
I: Freeze,
impl<I> RefUnwindSafe for InputError<I>where
I: RefUnwindSafe,
impl<I> Send for InputError<I>where
I: Send,
impl<I> Sync for InputError<I>where
I: Sync,
impl<I> Unpin for InputError<I>where
I: Unpin,
impl<I> UnwindSafe for InputError<I>where
I: 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