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.
Methods
impl<F, T> FnPredicate<F, T> where
F: Fn(&T) -> bool,
[src]
impl<F, T> FnPredicate<F, T> where
F: Fn(&T) -> bool,
pub fn fn_name(self, name: &'static str) -> Self
[src]
pub fn fn_name(self, name: &'static str) -> Self
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: Debug, T: Debug> Debug for FnPredicate<F, T> where
F: Fn(&T) -> bool,
[src]
impl<F: Debug, T: Debug> Debug for FnPredicate<F, T> where
F: Fn(&T) -> bool,
fn fmt(&self, f: &mut Formatter) -> Result
[src]
fn fmt(&self, f: &mut Formatter) -> Result
Formats the value using the given formatter. Read more
impl<F: Clone, T: Clone> Clone for FnPredicate<F, T> where
F: Fn(&T) -> bool,
[src]
impl<F: Clone, T: Clone> Clone for FnPredicate<F, T> where
F: Fn(&T) -> bool,
fn clone(&self) -> FnPredicate<F, T>
[src]
fn clone(&self) -> FnPredicate<F, T>
Returns a copy of the value. Read more
fn clone_from(&mut self, source: &Self)
1.0.0[src]
fn clone_from(&mut self, source: &Self)
1.0.0
[src]Performs copy-assignment from source
. Read more
impl<F: Copy, T: Copy> Copy for FnPredicate<F, T> where
F: Fn(&T) -> bool,
[src]
impl<F: Copy, T: Copy> Copy for FnPredicate<F, T> where
F: Fn(&T) -> bool,
impl<F: PartialEq, T: PartialEq> PartialEq for FnPredicate<F, T> where
F: Fn(&T) -> bool,
[src]
impl<F: PartialEq, T: PartialEq> PartialEq for FnPredicate<F, T> where
F: Fn(&T) -> bool,
fn eq(&self, other: &FnPredicate<F, T>) -> bool
[src]
fn eq(&self, other: &FnPredicate<F, T>) -> bool
This method tests for self
and other
values to be equal, and is used by ==
. Read more
fn ne(&self, other: &FnPredicate<F, T>) -> bool
[src]
fn ne(&self, other: &FnPredicate<F, T>) -> bool
This method tests for !=
.
impl<F: Eq, T: Eq> Eq for FnPredicate<F, T> where
F: Fn(&T) -> bool,
[src]
impl<F: Eq, T: Eq> Eq for FnPredicate<F, T> where
F: Fn(&T) -> bool,
impl<F, T> Predicate<T> for FnPredicate<F, T> where
F: Fn(&T) -> bool,
[src]
impl<F, T> Predicate<T> for FnPredicate<F, T> where
F: Fn(&T) -> bool,
fn eval(&self, variable: &T) -> bool
[src]
fn eval(&self, variable: &T) -> bool
Execute this Predicate
against variable
, returning the resulting boolean. Read more
impl<F, T> Display for FnPredicate<F, T> where
F: Fn(&T) -> bool,
[src]
impl<F, T> Display for FnPredicate<F, T> where
F: Fn(&T) -> bool,
Auto Trait Implementations
impl<F, T> Send for FnPredicate<F, T> where
F: Send,
T: Send,
impl<F, T> Send for FnPredicate<F, T> where
F: Send,
T: Send,
impl<F, T> Sync for FnPredicate<F, T> where
F: Sync,
T: Sync,
impl<F, T> Sync for FnPredicate<F, T> where
F: Sync,
T: Sync,