Struct winnow::error::InputError
source · 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>
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)>
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 moresource§impl<I: PartialEq + Clone> PartialEq for InputError<I>
impl<I: PartialEq + Clone> PartialEq for InputError<I>
source§fn eq(&self, other: &InputError<I>) -> bool
fn eq(&self, other: &InputError<I>) -> bool
This method tests for
self
and other
values to be equal, and is used
by ==
.impl<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
source§impl<T> CloneToUninit for Twhere
T: Clone,
impl<T> CloneToUninit for Twhere
T: Clone,
source§default unsafe fn clone_to_uninit(&self, dst: *mut T)
default unsafe fn clone_to_uninit(&self, dst: *mut T)
🔬This is a nightly-only experimental API. (
clone_to_uninit
)source§impl<T> CloneToUninit for Twhere
T: Copy,
impl<T> CloneToUninit for Twhere
T: Copy,
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
)