pub struct ChainCodec<T, U> { /* private fields */ }
Expand description
Represents a codec that chains together other codecs such that encoding will call the encode methods of the underlying, chained codecs from left-to-right and decoding will call the decode methods in reverse order
Implementations§
Source§impl<T, U> ChainCodec<T, U>
impl<T, U> ChainCodec<T, U>
Sourcepub fn new(left: T, right: U) -> Self
pub fn new(left: T, right: U) -> Self
Chains two codecs together such that left
will be invoked first during encoding and
right
will be invoked first during decoding
Sourcepub fn into_right(self) -> U
pub fn into_right(self) -> U
Consumes the chain and returns the right codec
Sourcepub fn into_left_right(self) -> (T, U)
pub fn into_left_right(self) -> (T, U)
Consumes the chain and returns the left and right codecs
Trait Implementations§
Source§impl<T: Clone, U: Clone> Clone for ChainCodec<T, U>
impl<T: Clone, U: Clone> Clone for ChainCodec<T, U>
Source§fn clone(&self) -> ChainCodec<T, U>
fn clone(&self) -> ChainCodec<T, U>
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<T, U> Codec for ChainCodec<T, U>
impl<T, U> Codec for ChainCodec<T, U>
Source§impl<T: Default, U: Default> Default for ChainCodec<T, U>
impl<T: Default, U: Default> Default for ChainCodec<T, U>
Source§fn default() -> ChainCodec<T, U>
fn default() -> ChainCodec<T, U>
Returns the “default value” for a type. Read more
impl<T: Copy, U: Copy> Copy for ChainCodec<T, U>
impl<T: Eq, U: Eq> Eq for ChainCodec<T, U>
impl<T, U> StructuralPartialEq for ChainCodec<T, U>
Auto Trait Implementations§
impl<T, U> Freeze for ChainCodec<T, U>
impl<T, U> RefUnwindSafe for ChainCodec<T, U>where
T: RefUnwindSafe,
U: RefUnwindSafe,
impl<T, U> Send for ChainCodec<T, U>
impl<T, U> Sync for ChainCodec<T, U>
impl<T, U> Unpin for ChainCodec<T, U>
impl<T, U> UnwindSafe for ChainCodec<T, U>where
T: UnwindSafe,
U: 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§impl<C> CodecExt for Cwhere
C: Codec,
impl<C> CodecExt for Cwhere
C: Codec,
Source§fn chain<T>(self, codec: T) -> ChainCodec<C, T>
fn chain<T>(self, codec: T) -> ChainCodec<C, T>
Chains this codec with another codec