Struct tokio_util_codec_compose::decode::adaptors::DecoderAndThen
source · pub struct DecoderAndThen<DFirst, F, DSecond, A, E> { /* private fields */ }Expand description
A decoder for sequence decoders with interdependency between each other.
The result of crate::decode::DecoderExt::and_then.
Implementations§
source§impl<DFirst, F, DSecond, A, EE> DecoderAndThen<DFirst, F, DSecond, A, EE>
impl<DFirst, F, DSecond, A, EE> DecoderAndThen<DFirst, F, DSecond, A, EE>
sourcepub fn first_value(&self) -> Option<&A>
pub fn first_value(&self) -> Option<&A>
Accesses the first decoder value.
sourcepub fn first_value_as_mut(&mut self) -> Option<&mut A>
pub fn first_value_as_mut(&mut self) -> Option<&mut A>
Mutably accesses the first decoder value.
Trait Implementations§
source§impl<DFirst: Debug, F: Debug, DSecond: Debug, A: Debug, E: Debug> Debug for DecoderAndThen<DFirst, F, DSecond, A, E>
impl<DFirst: Debug, F: Debug, DSecond: Debug, A: Debug, E: Debug> Debug for DecoderAndThen<DFirst, F, DSecond, A, E>
source§impl<DFirst, F, DSecond, A, B, EA, EB, EE> Decoder for DecoderAndThen<DFirst, F, DSecond, A, EE>where
DFirst: Decoder<Item = A, Error = EA>,
F: Fn(&A) -> DSecond,
DSecond: Decoder<Item = B, Error = EB>,
EA: From<Error>,
EB: From<Error>,
EE: From<Error> + From<EA> + From<EB>,
impl<DFirst, F, DSecond, A, B, EA, EB, EE> Decoder for DecoderAndThen<DFirst, F, DSecond, A, EE>where DFirst: Decoder<Item = A, Error = EA>, F: Fn(&A) -> DSecond, DSecond: Decoder<Item = B, Error = EB>, EA: From<Error>, EB: From<Error>, EE: From<Error> + From<EA> + From<EB>,
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<DFirst, F, DSecond, A, E> RefUnwindSafe for DecoderAndThen<DFirst, F, DSecond, A, E>where A: RefUnwindSafe, DFirst: RefUnwindSafe, DSecond: RefUnwindSafe, E: RefUnwindSafe, F: RefUnwindSafe,
impl<DFirst, F, DSecond, A, E> Send for DecoderAndThen<DFirst, F, DSecond, A, E>where A: Send, DFirst: Send, DSecond: Send, E: Send, F: Send,
impl<DFirst, F, DSecond, A, E> Sync for DecoderAndThen<DFirst, F, DSecond, A, E>where A: Sync, DFirst: Sync, DSecond: Sync, E: Sync, F: Sync,
impl<DFirst, F, DSecond, A, E> Unpin for DecoderAndThen<DFirst, F, DSecond, A, E>where A: Unpin, DFirst: Unpin, DSecond: Unpin, E: Unpin, F: Unpin,
impl<DFirst, F, DSecond, A, E> UnwindSafe for DecoderAndThen<DFirst, F, DSecond, A, E>where A: UnwindSafe, DFirst: UnwindSafe, DSecond: 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