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§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> StructuralPartialEq 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> Send for FnPredicate<F, T>
impl<F, T> Sync 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: Clone,
impl<T> CloneToUninit for Twhere
T: Clone,
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<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 moreSource§impl<P, Item> PredicateBoxExt<Item> for Pwhere
P: Predicate<Item>,
impl<P, Item> PredicateBoxExt<Item> for Pwhere
P: Predicate<Item>,
Source§impl<P> PredicateFileContentExt for P
impl<P> PredicateFileContentExt for P
Source§fn from_file_path(self) -> FileContentPredicate<Self>
fn from_file_path(self) -> FileContentPredicate<Self>
Source§impl<P, Item> PredicateNameExt<Item> for P
impl<P, Item> PredicateNameExt<Item> for P
Source§impl<P> PredicateStrExt for P
impl<P> PredicateStrExt for P
Source§fn trim(self) -> TrimPredicate<Self>
fn trim(self) -> TrimPredicate<Self>
Source§fn from_utf8(self) -> Utf8Predicate<Self>
fn from_utf8(self) -> Utf8Predicate<Self>
Source§fn normalize(self) -> NormalizedPredicate<Self>
fn normalize(self) -> NormalizedPredicate<Self>
Returns a
NormalizedPredicate
that ensures
the newlines within the data passed to Self
is normalised. Read more