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,
T: ?Sized,
[src]
impl<F, T> FnPredicate<F, T> where
F: Fn(&T) -> bool,
T: ?Sized,
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 for FnPredicate<F, T> where
F: Fn(&T) -> bool,
T: Debug + ?Sized,
[src]
impl<F: Debug, T> Debug for FnPredicate<F, T> where
F: Fn(&T) -> bool,
T: Debug + ?Sized,
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 for FnPredicate<F, T> where
F: Fn(&T) -> bool,
T: Clone + ?Sized,
[src]
impl<F: Clone, T> Clone for FnPredicate<F, T> where
F: Fn(&T) -> bool,
T: Clone + ?Sized,
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 for FnPredicate<F, T> where
F: Fn(&T) -> bool,
T: Copy + ?Sized,
[src]
impl<F: Copy, T> Copy for FnPredicate<F, T> where
F: Fn(&T) -> bool,
T: Copy + ?Sized,
impl<F: PartialEq, T> PartialEq for FnPredicate<F, T> where
F: Fn(&T) -> bool,
T: PartialEq + ?Sized,
[src]
impl<F: PartialEq, T> PartialEq for FnPredicate<F, T> where
F: Fn(&T) -> bool,
T: PartialEq + ?Sized,
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 for FnPredicate<F, T> where
F: Fn(&T) -> bool,
T: Eq + ?Sized,
[src]
impl<F: Eq, T> Eq for FnPredicate<F, T> where
F: Fn(&T) -> bool,
T: Eq + ?Sized,
impl<F, T> Predicate<T> for FnPredicate<F, T> where
F: Fn(&T) -> bool,
T: ?Sized,
[src]
impl<F, T> Predicate<T> for FnPredicate<F, T> where
F: Fn(&T) -> bool,
T: ?Sized,
fn eval(&self, variable: &T) -> bool
[src]
fn eval(&self, variable: &T) -> bool
Execute this Predicate
against variable
, returning the resulting boolean. Read more
fn find_case<'a>(&'a self, expected: bool, variable: &T) -> Option<Case<'a>>
[src]
fn find_case<'a>(&'a self, expected: bool, variable: &T) -> Option<Case<'a>>
Find a case that proves this predicate as expected
when run against variable
.
impl<F, T> PredicateReflection for FnPredicate<F, T> where
F: Fn(&T) -> bool,
T: ?Sized,
[src]
impl<F, T> PredicateReflection for FnPredicate<F, T> where
F: Fn(&T) -> bool,
T: ?Sized,
ⓘImportant traits for Box<R>fn parameters(&'a self) -> Box<Iterator<Item = Parameter<'a>> + 'a>
[src]
ⓘImportant traits for Box<R>
fn parameters(&'a self) -> Box<Iterator<Item = Parameter<'a>> + 'a>
Parameters of the current Predicate
.
ⓘImportant traits for Box<R>fn children(&'a self) -> Box<Iterator<Item = Child<'a>> + 'a>
[src]
ⓘImportant traits for Box<R>
fn children(&'a self) -> Box<Iterator<Item = Child<'a>> + 'a>
Nested Predicate
s of the current Predicate
.
impl<F, T> Display for FnPredicate<F, T> where
F: Fn(&T) -> bool,
T: ?Sized,
[src]
impl<F, T> Display for FnPredicate<F, T> where
F: Fn(&T) -> bool,
T: ?Sized,
Auto Trait Implementations
impl<F, T: ?Sized> Send for FnPredicate<F, T> where
F: Send,
T: Send,
impl<F, T: ?Sized> Send for FnPredicate<F, T> where
F: Send,
T: Send,
impl<F, T: ?Sized> Sync for FnPredicate<F, T> where
F: Sync,
T: Sync,
impl<F, T: ?Sized> Sync for FnPredicate<F, T> where
F: Sync,
T: Sync,