Struct predicates::function::FnPredicate
source · pub struct FnPredicate<F, T>{ /* private fields */ }
Expand description
Predicate that wraps a function over a reference that returns a bool
.
This type is returned by the predicate::function
function.
Implementations§
source§impl<F, T> FnPredicate<F, T>
impl<F, T> FnPredicate<F, T>
sourcepub fn fn_name(self, name: &'static str) -> Self
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§
source§impl<F, T> Clone for FnPredicate<F, T>
impl<F, T> Clone for FnPredicate<F, T>
source§fn clone(&self) -> FnPredicate<F, T>
fn clone(&self) -> FnPredicate<F, T>
Returns a copy of the value. Read more
1.0.0 · source§fn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
Performs copy-assignment from
source
. Read moresource§impl<F, T> Debug for FnPredicate<F, T>
impl<F, T> Debug for FnPredicate<F, T>
source§impl<F, T> Display for FnPredicate<F, T>
impl<F, T> Display for FnPredicate<F, T>
source§impl<F, T> PartialEq for FnPredicate<F, T>
impl<F, T> PartialEq for FnPredicate<F, T>
source§fn eq(&self, other: &FnPredicate<F, T>) -> bool
fn eq(&self, other: &FnPredicate<F, T>) -> bool
This method tests for
self
and other
values to be equal, and is used
by ==
.source§impl<F, T> Predicate<T> for FnPredicate<F, T>
impl<F, T> Predicate<T> for FnPredicate<F, T>
source§impl<F, T> PredicateReflection for FnPredicate<F, T>
impl<F, T> PredicateReflection for FnPredicate<F, T>
impl<F, T> Copy for FnPredicate<F, T>
impl<F, T> Eq for FnPredicate<F, T>
impl<F, T> Send for FnPredicate<F, T>
impl<F, T> StructuralPartialEq for FnPredicate<F, T>
impl<F, T> Sync for FnPredicate<F, T>
Auto Trait Implementations§
impl<F, T> Freeze for FnPredicate<F, T>
impl<F, T> RefUnwindSafe for FnPredicate<F, T>
impl<F, T> Unpin for FnPredicate<F, T>
impl<F, T> UnwindSafe for FnPredicate<F, T>
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
source§impl<T> CloneToUninit for Twhere
T: Copy,
impl<T> CloneToUninit for Twhere
T: Copy,
source§unsafe fn clone_to_uninit(&self, dst: *mut T)
unsafe fn clone_to_uninit(&self, dst: *mut T)
🔬This is a nightly-only experimental API. (
clone_to_uninit
)source§impl<T> CloneToUninit for Twhere
T: Clone,
impl<T> CloneToUninit for Twhere
T: Clone,
source§default unsafe fn clone_to_uninit(&self, dst: *mut T)
default unsafe fn clone_to_uninit(&self, dst: *mut T)
🔬This is a nightly-only experimental API. (
clone_to_uninit
)source§impl<P, Item> PredicateBooleanExt<Item> for P
impl<P, Item> PredicateBooleanExt<Item> for P
source§fn and<B>(self, other: B) -> AndPredicate<Self, B, Item>
fn and<B>(self, other: B) -> AndPredicate<Self, B, Item>
Compute the logical AND of two
Predicate
results, returning the result. Read moresource§fn or<B>(self, other: B) -> OrPredicate<Self, B, Item>
fn or<B>(self, other: B) -> OrPredicate<Self, B, Item>
Compute the logical OR of two
Predicate
results, returning the result. Read more