MapErr

Struct MapErr 

Source
pub struct MapErr<T, P, F, E>
where P: Parse<T>, F: Fn(P::Err) -> E,
{ /* private fields */ }
Expand description

The parser for Parse::map_err, see method for documentation.

Trait Implementations§

Source§

impl<T: Clone, P, F, E: Clone> Clone for MapErr<T, P, F, E>
where P: Parse<T> + Clone, F: Fn(P::Err) -> E + Clone,

Source§

fn clone(&self) -> MapErr<T, P, F, E>

Returns a duplicate of the value. Read more
1.0.0 · Source§

fn clone_from(&mut self, source: &Self)

Performs copy-assignment from source. Read more
Source§

impl<T: Debug, P, F, E: Debug> Debug for MapErr<T, P, F, E>
where P: Parse<T> + Debug, F: Fn(P::Err) -> E + Debug,

Source§

fn fmt(&self, f: &mut Formatter<'_>) -> Result

Formats the value using the given formatter. Read more
Source§

impl<T: Hash, P, F, E: Hash> Hash for MapErr<T, P, F, E>
where P: Parse<T> + Hash, F: Fn(P::Err) -> E + Hash,

Source§

fn hash<__H: Hasher>(&self, state: &mut __H)

Feeds this value into the given Hasher. Read more
1.3.0 · Source§

fn hash_slice<H>(data: &[Self], state: &mut H)
where H: Hasher, Self: Sized,

Feeds a slice of this type into the given Hasher. Read more
Source§

impl<T, P, F, E> Parse<T> for MapErr<T, P, F, E>
where P: Parse<T>, F: Fn(P::Err) -> E,

Source§

type Err = E

Source§

type Output = <P as Parse<T>>::Output

Source§

fn parse(self, input: T) -> Result<(T, Self::Output), Self::Err>

Try to parse part of a slice, returning a tuple of the remainder (the unparsed slice) and the output value.
Source§

fn map<F, O>(self, func: F) -> Map<T, Self, F, O>
where F: Fn(Self::Output) -> O, Self: Sized,

Maps the output of a parser with a function to produce a new output. Read more
Source§

fn map_err<F, E>(self, func: F) -> MapErr<T, Self, F, E>
where F: Fn(Self::Err) -> E, Self: Sized,

Maps the error of a parser with a function to produce a new error.
Source§

fn maybe(self) -> Maybe<T, Self>
where T: Clone, Self: Sized,

Executes the parser if possible, wrapping up the output in an Option. Read more
Source§

fn chain<I>(self, inner: I) -> Chain<T, Self, I>
where I: Parse<Self::Output, Err = Self::Err>, Self: Sized,

Parses the output of this parser with an inner parser, and passes the output through.
Source§

fn or<O>(self, other: O) -> Or<T, Self, O>
where T: Clone, O: Parse<T, Output = Self::Output, Err = Self::Err>, Self: Sized,

Takes the union of both combinators, accepting input which passes either parser. Both parsers must output the same type. Read more
Source§

fn and<O>(self, length_err: Self::Err, other: O) -> And<T, Self, O>
where T: Clone + Eq, O: Parse<T, Err = Self::Err>, Self: Sized,

Takes the conjunction of both combinators, accepting input which passes both parsers. The remainders of both combinators must be equal, otherwise the specified length error is yielded. Read more
Source§

fn fuse<O>(self, other: O) -> Fuse<T, Self, O>
where O: Parse<T, Err = Self::Err>, Self: Sized,

Accepts input which passes this parser first and then other, packing the output as a tuple. The remainder of the input is passed to other. Read more
Source§

fn fuse_extend<O>(self, other: O) -> FuseExtend<T, Self, Self::Output, O>
where O: Parse<T, Err = Self::Err>, Self::Output: Extend<O::Output>, Self: Sized,

Accepts input which passes this parser first and then other, extending this output with other’s output. The remainder of the input is passed to other. Read more
Source§

fn repeat_const<const N: usize>(self) -> RepeatConst<T, Self, N>
where Self: Clone + Sized,

Accepts exactly a constant amount of repetitions of this parser, packing the output as a constant array. Read more
Source§

fn repeat_greedy<O>(self, default: O) -> RepeatGreedy<T, Self, O>
where T: Clone, O: Extend<Self::Output>, Self: Clone + Sized,

Accepts any amount of repetitions of this parser, extending the output into the given collection. Read more
Source§

impl<T: PartialEq, P, F, E: PartialEq> PartialEq for MapErr<T, P, F, E>
where P: Parse<T> + PartialEq, F: Fn(P::Err) -> E + PartialEq,

Source§

fn eq(&self, other: &MapErr<T, P, F, E>) -> bool

Tests for self and other values to be equal, and is used by ==.
1.0.0 · Source§

fn ne(&self, other: &Rhs) -> bool

Tests for !=. The default implementation is almost always sufficient, and should not be overridden without very good reason.
Source§

impl<T: Eq, P, F, E: Eq> Eq for MapErr<T, P, F, E>
where P: Parse<T> + Eq, F: Fn(P::Err) -> E + Eq,

Source§

impl<T, P, F, E> StructuralPartialEq for MapErr<T, P, F, E>
where P: Parse<T>, F: Fn(P::Err) -> E,

Auto Trait Implementations§

§

impl<T, P, F, E> Freeze for MapErr<T, P, F, E>
where P: Freeze, F: Freeze,

§

impl<T, P, F, E> RefUnwindSafe for MapErr<T, P, F, E>

§

impl<T, P, F, E> Send for MapErr<T, P, F, E>
where P: Send, F: Send, T: Send,

§

impl<T, P, F, E> Sync for MapErr<T, P, F, E>
where P: Sync, F: Sync, T: Sync,

§

impl<T, P, F, E> Unpin for MapErr<T, P, F, E>
where P: Unpin, F: Unpin, T: Unpin,

§

impl<T, P, F, E> UnwindSafe for MapErr<T, P, F, E>
where P: UnwindSafe, F: UnwindSafe, T: UnwindSafe,

Blanket Implementations§

Source§

impl<T> Any for T
where T: 'static + ?Sized,

Source§

fn type_id(&self) -> TypeId

Gets the TypeId of self. Read more
Source§

impl<T> Borrow<T> for T
where T: ?Sized,

Source§

fn borrow(&self) -> &T

Immutably borrows from an owned value. Read more
Source§

impl<T> BorrowMut<T> for T
where T: ?Sized,

Source§

fn borrow_mut(&mut self) -> &mut T

Mutably borrows from an owned value. Read more
Source§

impl<T> CloneToUninit for T
where T: Clone,

Source§

unsafe fn clone_to_uninit(&self, dest: *mut u8)

🔬This is a nightly-only experimental API. (clone_to_uninit)
Performs copy-assignment from self to dest. Read more
Source§

impl<T> From<T> for T

Source§

fn from(t: T) -> T

Returns the argument unchanged.

Source§

impl<T, U> Into<U> for T
where U: From<T>,

Source§

fn into(self) -> U

Calls U::from(self).

That is, this conversion is whatever the implementation of From<T> for U chooses to do.

Source§

impl<T> ToOwned for T
where T: Clone,

Source§

type Owned = T

The resulting type after obtaining ownership.
Source§

fn to_owned(&self) -> T

Creates owned data from borrowed data, usually by cloning. Read more
Source§

fn clone_into(&self, target: &mut T)

Uses borrowed data to replace owned data, usually by cloning. Read more
Source§

impl<T, U> TryFrom<U> for T
where U: Into<T>,

Source§

type Error = Infallible

The type returned in the event of a conversion error.
Source§

fn try_from(value: U) -> Result<T, <T as TryFrom<U>>::Error>

Performs the conversion.
Source§

impl<T, U> TryInto<U> for T
where U: TryFrom<T>,

Source§

type Error = <U as TryFrom<T>>::Error

The type returned in the event of a conversion error.
Source§

fn try_into(self) -> Result<U, <U as TryFrom<T>>::Error>

Performs the conversion.