Struct tokio_util_codec_compose::decode::adaptors::DecoderTryMap
source · pub struct DecoderTryMap<D, F, E> { /* private fields */ }Expand description
A decoder for applying a fallible transformation on the success type.
The result of crate::decode::DecoderExt::try_map.
Trait Implementations§
source§impl<D, F, A, B, E, EE> Decoder for DecoderTryMap<D, F, EE>where
D: Decoder<Item = A, Error = E>,
F: Fn(A) -> Result<B, EE>,
E: From<Error>,
EE: From<Error> + From<E>,
impl<D, F, A, B, E, EE> Decoder for DecoderTryMap<D, F, EE>where D: Decoder<Item = A, Error = E>, F: Fn(A) -> Result<B, EE>, E: From<Error>, EE: From<Error> + From<E>,
source§fn decode(
&mut self,
src: &mut BytesMut
) -> Result<Option<Self::Item>, Self::Error>
fn decode( &mut self, src: &mut BytesMut ) -> Result<Option<Self::Item>, Self::Error>
Attempts to decode a frame from the provided buffer of bytes. Read more
Auto Trait Implementations§
impl<D, F, E> RefUnwindSafe for DecoderTryMap<D, F, E>where D: RefUnwindSafe, E: RefUnwindSafe, F: RefUnwindSafe,
impl<D, F, E> Send for DecoderTryMap<D, F, E>where D: Send, E: Send, F: Send,
impl<D, F, E> Sync for DecoderTryMap<D, F, E>where D: Sync, E: Sync, F: Sync,
impl<D, F, E> Unpin for DecoderTryMap<D, F, E>where D: Unpin, E: Unpin, F: Unpin,
impl<D, F, E> UnwindSafe for DecoderTryMap<D, F, E>where D: UnwindSafe, E: UnwindSafe, F: 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<D, A, E> DecoderExt<A, E> for Dwhere
D: Decoder<Item = A, Error = E>,
impl<D, A, E> DecoderExt<A, E> for Dwhere D: Decoder<Item = A, Error = E>,
source§fn try_map<F, B, EE>(self, f: F) -> DecoderTryMap<Self, F, EE>where
F: Fn(A) -> Result<B, EE>,
Self: Sized,
fn try_map<F, B, EE>(self, f: F) -> DecoderTryMap<Self, F, EE>where F: Fn(A) -> Result<B, EE>, Self: Sized,
Applies a fallible function
f of type A -> Result<B, EE> over the decoded value when that is Ok(Some(a)). Read moresource§fn try_map_into<B>(self) -> DecoderTryMapInto<Self, B, B::Error>where
B: TryFrom<A>,
Self: Sized,
fn try_map_into<B>(self) -> DecoderTryMapInto<Self, B, B::Error>where B: TryFrom<A>, Self: Sized,
source§fn then<DNext, B, EE>(self, next: DNext) -> DecoderThen<Self, DNext, A, EE>where
DNext: Decoder<Item = B, Error = EE>,
EE: From<E>,
Self: Sized,
fn then<DNext, B, EE>(self, next: DNext) -> DecoderThen<Self, DNext, A, EE>where DNext: Decoder<Item = B, Error = EE>, EE: From<E>, Self: Sized,
Chains a decoder of
B on the remaining bytes after applying this decoder, then returns a pair of the individual values (a, b). Read moresource§fn and_then<F, DNext, B, EE>(
self,
f: F
) -> DecoderAndThen<Self, F, DNext, A, EE>where
F: Fn(&A) -> DNext,
DNext: Decoder<Item = B, Error = EE>,
EE: From<E>,
Self: Sized,
fn and_then<F, DNext, B, EE>( self, f: F ) -> DecoderAndThen<Self, F, DNext, A, EE>where F: Fn(&A) -> DNext, DNext: Decoder<Item = B, Error = EE>, EE: From<E>, Self: Sized,
Chains a function
f of type &A -> Box<Decoder<Item = B, Error = E>> over the decoded value when that is Ok(Some(a)). Read more