Struct predicates::function::FnPredicate [−][src]
Predicate that wraps a function over a reference that returns a bool
.
This type is returned by the predicate::function
function.
Implementations
impl<F, T> FnPredicate<F, T> where
F: Fn(&T) -> bool,
T: ?Sized,
[src]
F: Fn(&T) -> bool,
T: ?Sized,
pub fn fn_name(mut self: Self, name: &'static str) -> Self
[src]
Provide a descriptive name for this function.
Examples
use predicates::prelude::*; struct Example { string: String, number: i32, } let string_check = predicate::function(|x: &Example| x.string == "hello") .fn_name("is_hello"); println!("predicate: {}", string_check);
Trait Implementations
impl<F: Clone, T> Clone for FnPredicate<F, T> where
F: Fn(&T) -> bool,
T: Clone + ?Sized,
[src]
F: Fn(&T) -> bool,
T: Clone + ?Sized,
fn clone(&self) -> FnPredicate<F, T>
[src]
pub fn clone_from(&mut self, source: &Self)
1.0.0[src]
impl<F: Copy, T> Copy for FnPredicate<F, T> where
F: Fn(&T) -> bool,
T: Copy + ?Sized,
[src]
F: Fn(&T) -> bool,
T: Copy + ?Sized,
impl<F: Debug, T> Debug for FnPredicate<F, T> where
F: Fn(&T) -> bool,
T: Debug + ?Sized,
[src]
F: Fn(&T) -> bool,
T: Debug + ?Sized,
impl<F, T> Display for FnPredicate<F, T> where
F: Fn(&T) -> bool,
T: ?Sized,
[src]
F: Fn(&T) -> bool,
T: ?Sized,
impl<F: Eq, T> Eq for FnPredicate<F, T> where
F: Fn(&T) -> bool,
T: Eq + ?Sized,
[src]
F: Fn(&T) -> bool,
T: Eq + ?Sized,
impl<F: PartialEq, T> PartialEq<FnPredicate<F, T>> for FnPredicate<F, T> where
F: Fn(&T) -> bool,
T: PartialEq + ?Sized,
[src]
F: Fn(&T) -> bool,
T: PartialEq + ?Sized,
fn eq(&self, other: &FnPredicate<F, T>) -> bool
[src]
fn ne(&self, other: &FnPredicate<F, T>) -> bool
[src]
impl<F, T> Predicate<T> for FnPredicate<F, T> where
F: Fn(&T) -> bool,
T: ?Sized,
[src]
F: Fn(&T) -> bool,
T: ?Sized,
fn eval(&self, variable: &T) -> bool
[src]
fn find_case<'a>(&'a self, expected: bool, variable: &T) -> Option<Case<'a>>
[src]
impl<F, T> PredicateReflection for FnPredicate<F, T> where
F: Fn(&T) -> bool,
T: ?Sized,
[src]
F: Fn(&T) -> bool,
T: ?Sized,
pub fn parameters(
&'a self
) -> Box<dyn Iterator<Item = Parameter<'a>> + 'a, Global>
[src]
&'a self
) -> Box<dyn Iterator<Item = Parameter<'a>> + 'a, Global>
pub fn children(&'a self) -> Box<dyn Iterator<Item = Child<'a>> + 'a, Global>
[src]
impl<F, T> StructuralEq for FnPredicate<F, T> where
F: Fn(&T) -> bool,
T: ?Sized,
[src]
F: Fn(&T) -> bool,
T: ?Sized,
impl<F, T> StructuralPartialEq for FnPredicate<F, T> where
F: Fn(&T) -> bool,
T: ?Sized,
[src]
F: Fn(&T) -> bool,
T: ?Sized,
Auto Trait Implementations
impl<F, T: ?Sized> RefUnwindSafe for FnPredicate<F, T> where
F: RefUnwindSafe,
T: RefUnwindSafe,
[src]
F: RefUnwindSafe,
T: RefUnwindSafe,
impl<F, T: ?Sized> Send for FnPredicate<F, T> where
F: Send,
T: Send,
[src]
F: Send,
T: Send,
impl<F, T: ?Sized> Sync for FnPredicate<F, T> where
F: Sync,
T: Sync,
[src]
F: Sync,
T: Sync,
impl<F, T: ?Sized> Unpin for FnPredicate<F, T> where
F: Unpin,
T: Unpin,
[src]
F: Unpin,
T: Unpin,
impl<F, T: ?Sized> UnwindSafe for FnPredicate<F, T> where
F: UnwindSafe,
T: UnwindSafe,
[src]
F: UnwindSafe,
T: UnwindSafe,
Blanket Implementations
impl<T> Any for T where
T: 'static + ?Sized,
[src]
T: 'static + ?Sized,
impl<T> Borrow<T> for T where
T: ?Sized,
[src]
T: ?Sized,
impl<T> BorrowMut<T> for T where
T: ?Sized,
[src]
T: ?Sized,
pub fn borrow_mut(&mut self) -> &mut T
[src]
impl<T> From<T> for T
[src]
impl<T, U> Into<U> for T where
U: From<T>,
[src]
U: From<T>,
impl<P, Item> PredicateBooleanExt<Item> for P where
Item: ?Sized,
P: Predicate<Item>,
[src]
Item: ?Sized,
P: Predicate<Item>,
fn and<B>(self, other: B) -> AndPredicate<Self, B, Item> where
B: Predicate<Item>,
Self: Sized,
[src]
B: Predicate<Item>,
Self: Sized,
fn or<B>(self, other: B) -> OrPredicate<Self, B, Item> where
B: Predicate<Item>,
Self: Sized,
[src]
B: Predicate<Item>,
Self: Sized,
fn not(self) -> NotPredicate<Self, Item> where
Self: Sized,
[src]
Self: Sized,
impl<P, Item> PredicateNameExt<Item> for P where
Item: ?Sized,
P: Predicate<Item>,
[src]
Item: ?Sized,
P: Predicate<Item>,
fn name(self, name: &'static str) -> NamePredicate<Self, Item> where
Self: Sized,
[src]
Self: Sized,
impl<T> ToOwned for T where
T: Clone,
[src]
T: Clone,
type Owned = T
The resulting type after obtaining ownership.
pub fn to_owned(&self) -> T
[src]
pub fn clone_into(&self, target: &mut T)
[src]
impl<T> ToString for T where
T: Display + ?Sized,
[src]
T: Display + ?Sized,
impl<T, U> TryFrom<U> for T where
U: Into<T>,
[src]
U: Into<T>,
type Error = Infallible
The type returned in the event of a conversion error.
pub fn try_from(value: U) -> Result<T, <T as TryFrom<U>>::Error>
[src]
impl<T, U> TryInto<U> for T where
U: TryFrom<T>,
[src]
U: TryFrom<T>,