pub struct Pet<T, P>(/* private fields */);Expand description
A value that is accepted by a given predicate.
Implementations§
Source§impl<T, P: Pred<T>> Pet<T, P>
impl<T, P: Pred<T>> Pet<T, P>
Sourcepub fn new(t: T) -> Option<Self>
pub fn new(t: T) -> Option<Self>
Attempts to create a new Pet<T, P> from a value t.
If P accepts t, then the result is a Some(..) containing the value t.
Otherwise, None is returned.
Sourcepub unsafe fn new_unchecked(t: T) -> Self
pub unsafe fn new_unchecked(t: T) -> Self
Creates a new Pet<T, P> from a value t without checking if P accepts t.
Trait Implementations§
Source§impl<'de, T, P: Pred<T>> Deserialize<'de> for Pet<T, P>where
T: Deserialize<'de>,
Available on crate feature serde only.
impl<'de, T, P: Pred<T>> Deserialize<'de> for Pet<T, P>where
T: Deserialize<'de>,
Available on crate feature
serde only.Source§fn deserialize<D>(deserializer: D) -> Result<Self, D::Error>where
D: Deserializer<'de>,
fn deserialize<D>(deserializer: D) -> Result<Self, D::Error>where
D: Deserializer<'de>,
Deserialize this value from the given Serde deserializer. Read more
Source§impl<T, P> Ord for Pet<T, P>where
T: Ord,
impl<T, P> Ord for Pet<T, P>where
T: Ord,
Source§impl<T, P, Q> PartialOrd<Pet<T, Q>> for Pet<T, P>where
T: PartialOrd,
impl<T, P, Q> PartialOrd<Pet<T, Q>> for Pet<T, P>where
T: PartialOrd,
Source§impl<T, P: Pred<T>> Serialize for Pet<T, P>where
T: Serialize,
Available on crate feature serde only.
impl<T, P: Pred<T>> Serialize for Pet<T, P>where
T: Serialize,
Available on crate feature
serde only.impl<T: Copy, P: Copy> Copy for Pet<T, P>
impl<T, P> Eq for Pet<T, P>where
T: Eq,
Auto Trait Implementations§
impl<T, P> Freeze for Pet<T, P>
impl<T, P> RefUnwindSafe for Pet<T, P>where
T: RefUnwindSafe,
P: RefUnwindSafe,
impl<T, P> Send for Pet<T, P>
impl<T, P> Sync for Pet<T, P>
impl<T, P> Unpin for Pet<T, P>
impl<T, P> UnwindSafe for Pet<T, P>where
T: UnwindSafe,
P: 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