Struct ThenTry

Source
pub struct ThenTry<E, First: Decoder, Second: Decoder, Fun: FnOnce(First::Value) -> Result<Second, E>>(/* private fields */)
where
    E: From<First::Error> + From<Second::Error>;

Trait Implementations§

Source§

impl<E, First: Debug + Decoder, Second: Debug + Decoder, Fun: Debug + FnOnce(First::Value) -> Result<Second, E>> Debug for ThenTry<E, First, Second, Fun>
where E: From<First::Error> + From<Second::Error> + Debug,

Source§

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

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

impl<E, First: Decoder, Second: Decoder, Fun: FnOnce(First::Value) -> Result<Second, E>> Decoder for ThenTry<E, First, Second, Fun>
where E: From<First::Error> + From<Second::Error>,

Source§

type Value = <Second as Decoder>::Value

The type of value produced by this decoder.
Source§

type Error = E

Decoding error.
Source§

fn decode_chunk(&mut self, bytes: &mut &[u8]) -> Result<(), Self::Error>

Processes nex chunk of bytes and updates the cursor. Read more
Source§

fn end(self) -> Result<Self::Value, Self::Error>

Called when decoding has ended or there are no more bytes. Read more
Source§

fn bytes_received(&mut self, bytes: &[u8]) -> Result<usize, Self::Error>

Processes nex chunk of bytes without updating the cursor. Read more
Source§

fn then<R: Decoder, F: FnOnce(Self::Value) -> R>( self, fun: F, ) -> Then<Self, R, F>

Chains another decoder after this one finishes such that the value of this one is used to initialize the next one.
Source§

fn then_try<E, R: Decoder, F: FnOnce(Self::Value) -> Result<R, E>>( self, fun: F, ) -> ThenTry<E, Self, R, F>
where E: From<Self::Error> + From<R::Error>,

Chains another decoder after this one finishes such that the value of this one is used to initialize the next one. Read more
Source§

fn chain<D: Decoder>(self, following: D) -> Chain<Self, D>

Chains another decoder after this one to decode two values.
Source§

fn wrap_sub_decode<F: FnOnce() -> ControlFlow<Result<(), Self::Error>, Infallible>>( f: F, ) -> Result<(), Self::Error>

Helper for using sub_decode. Read more

Auto Trait Implementations§

§

impl<E, First, Second, Fun> Freeze for ThenTry<E, First, Second, Fun>
where First: Freeze, Fun: Freeze, Second: Freeze,

§

impl<E, First, Second, Fun> RefUnwindSafe for ThenTry<E, First, Second, Fun>
where First: RefUnwindSafe, Fun: RefUnwindSafe, Second: RefUnwindSafe,

§

impl<E, First, Second, Fun> Send for ThenTry<E, First, Second, Fun>
where First: Send, Fun: Send, Second: Send,

§

impl<E, First, Second, Fun> Sync for ThenTry<E, First, Second, Fun>
where First: Sync, Fun: Sync, Second: Sync,

§

impl<E, First, Second, Fun> Unpin for ThenTry<E, First, Second, Fun>
where First: Unpin, Fun: Unpin, Second: Unpin,

§

impl<E, First, Second, Fun> UnwindSafe for ThenTry<E, First, Second, Fun>
where First: UnwindSafe, Fun: UnwindSafe, Second: 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> 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> IntoEither for T

Source§

fn into_either(self, into_left: bool) -> Either<Self, Self>

Converts self into a Left variant of Either<Self, Self> if into_left is true. Converts self into a Right variant of Either<Self, Self> otherwise. Read more
Source§

fn into_either_with<F>(self, into_left: F) -> Either<Self, Self>
where F: FnOnce(&Self) -> bool,

Converts self into a Left variant of Either<Self, Self> if into_left(&self) returns true. Converts self into a Right variant of Either<Self, Self> otherwise. 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.