pub struct PredicateCodec<T, U, P> { /* private fields */ }
Expand description
Represents a codec that invokes one of two codecs based on the given predicate
Implementations§
Source§impl<T, U, P> PredicateCodec<T, U, P>
impl<T, U, P> PredicateCodec<T, U, P>
Sourcepub fn new(left: T, right: U, predicate: P) -> Self
pub fn new(left: T, right: U, predicate: P) -> Self
Creates a new predicate codec where the left codec is invoked if the predicate returns true and the right codec is invoked if the predicate returns false
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, U, P> Clone for PredicateCodec<T, U, P>
impl<T, U, P> Clone for PredicateCodec<T, U, P>
Source§impl<T, U, P> Codec for PredicateCodec<T, U, P>
impl<T, U, P> Codec for PredicateCodec<T, U, P>
Source§impl<T: Default, U: Default, P: Default> Default for PredicateCodec<T, U, P>
impl<T: Default, U: Default, P: Default> Default for PredicateCodec<T, U, P>
Source§fn default() -> PredicateCodec<T, U, P>
fn default() -> PredicateCodec<T, U, P>
Returns the “default value” for a type. Read more
impl<T: Eq, U: Eq, P: Eq> Eq for PredicateCodec<T, U, P>
impl<T, U, P> StructuralPartialEq for PredicateCodec<T, U, P>
Auto Trait Implementations§
impl<T, U, P> Freeze for PredicateCodec<T, U, P>
impl<T, U, P> RefUnwindSafe for PredicateCodec<T, U, P>
impl<T, U, P> Send for PredicateCodec<T, U, P>
impl<T, U, P> Sync for PredicateCodec<T, U, P>
impl<T, U, P> Unpin for PredicateCodec<T, U, P>
impl<T, U, P> UnwindSafe for PredicateCodec<T, U, P>
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