Struct distant_net::common::PredicateCodec
source · 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
sourceimpl<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
sourceimpl<T, U, P> Clone for PredicateCodec<T, U, P>where
T: Clone,
U: Clone,
impl<T, U, P> Clone for PredicateCodec<T, U, P>where
T: Clone,
U: Clone,
sourceimpl<T, U, P> Codec for PredicateCodec<T, U, P>where
T: Codec + Clone,
U: Codec + Clone,
P: Fn(&Frame<'_>) -> bool,
impl<T, U, P> Codec for PredicateCodec<T, U, P>where
T: Codec + Clone,
U: Codec + Clone,
P: Fn(&Frame<'_>) -> bool,
sourceimpl<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>
sourcefn default() -> PredicateCodec<T, U, P>
fn default() -> PredicateCodec<T, U, P>
Returns the “default value” for a type. Read more
sourceimpl<T: PartialEq, U: PartialEq, P: PartialEq> PartialEq<PredicateCodec<T, U, P>> for PredicateCodec<T, U, P>
impl<T: PartialEq, U: PartialEq, P: PartialEq> PartialEq<PredicateCodec<T, U, P>> for PredicateCodec<T, U, P>
sourcefn eq(&self, other: &PredicateCodec<T, U, P>) -> bool
fn eq(&self, other: &PredicateCodec<T, U, P>) -> bool
impl<T: Eq, U: Eq, P: Eq> Eq for PredicateCodec<T, U, P>
impl<T, U, P> StructuralEq for PredicateCodec<T, U, P>
impl<T, U, P> StructuralPartialEq for PredicateCodec<T, U, P>
Auto Trait Implementations
impl<T, U, P> RefUnwindSafe for PredicateCodec<T, U, P>where
P: RefUnwindSafe,
T: RefUnwindSafe,
U: RefUnwindSafe,
impl<T, U, P> Send for PredicateCodec<T, U, P>where
P: Send + Sync,
T: Send,
U: Send,
impl<T, U, P> Sync for PredicateCodec<T, U, P>where
P: Send + Sync,
T: Sync,
U: Sync,
impl<T, U, P> Unpin for PredicateCodec<T, U, P>where
T: Unpin,
U: Unpin,
impl<T, U, P> UnwindSafe for PredicateCodec<T, U, P>where
P: RefUnwindSafe,
T: UnwindSafe,
U: UnwindSafe,
Blanket Implementations
sourceimpl<T> BorrowMut<T> for Twhere
T: ?Sized,
impl<T> BorrowMut<T> for Twhere
T: ?Sized,
const: unstable · sourcefn borrow_mut(&mut self) -> &mut T
fn borrow_mut(&mut self) -> &mut T
Mutably borrows from an owned value. Read more