Struct predicates::function::FnPredicate[][src]

pub struct FnPredicate<F, T> where
    F: Fn(&T) -> bool,
    T: ?Sized
{ /* fields omitted */ }

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]

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]

impl<F: Copy, T> Copy for FnPredicate<F, T> where
    F: Fn(&T) -> bool,
    T: Copy + ?Sized
[src]

impl<F: Debug, T> Debug for FnPredicate<F, T> where
    F: Fn(&T) -> bool,
    T: Debug + ?Sized
[src]

impl<F, T> Display for FnPredicate<F, T> where
    F: Fn(&T) -> bool,
    T: ?Sized
[src]

impl<F: Eq, T> Eq for FnPredicate<F, T> where
    F: Fn(&T) -> bool,
    T: Eq + ?Sized
[src]

impl<F: PartialEq, T> PartialEq<FnPredicate<F, T>> for FnPredicate<F, T> where
    F: Fn(&T) -> bool,
    T: PartialEq + ?Sized
[src]

impl<F, T> Predicate<T> 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
[src]

impl<F, T> StructuralEq for FnPredicate<F, T> where
    F: Fn(&T) -> bool,
    T: ?Sized
[src]

impl<F, T> StructuralPartialEq for FnPredicate<F, T> where
    F: Fn(&T) -> bool,
    T: ?Sized
[src]

Auto Trait Implementations

impl<F, T: ?Sized> RefUnwindSafe for FnPredicate<F, T> where
    F: RefUnwindSafe,
    T: RefUnwindSafe
[src]

impl<F, T: ?Sized> Send for FnPredicate<F, T> where
    F: Send,
    T: Send
[src]

impl<F, T: ?Sized> Sync for FnPredicate<F, T> where
    F: Sync,
    T: Sync
[src]

impl<F, T: ?Sized> Unpin for FnPredicate<F, T> where
    F: Unpin,
    T: Unpin
[src]

impl<F, T: ?Sized> UnwindSafe for FnPredicate<F, T> where
    F: UnwindSafe,
    T: UnwindSafe
[src]

Blanket Implementations

impl<T> Any for T where
    T: 'static + ?Sized
[src]

impl<T> Borrow<T> for T where
    T: ?Sized
[src]

impl<T> BorrowMut<T> for T where
    T: ?Sized
[src]

impl<T> From<T> for T[src]

impl<T, U> Into<U> for T where
    U: From<T>, 
[src]

impl<P, Item> PredicateBooleanExt<Item> for P where
    Item: ?Sized,
    P: Predicate<Item>, 
[src]

impl<P, Item> PredicateNameExt<Item> for P where
    Item: ?Sized,
    P: Predicate<Item>, 
[src]

impl<T> ToOwned for T where
    T: Clone
[src]

type Owned = T

The resulting type after obtaining ownership.

impl<T> ToString for T where
    T: Display + ?Sized
[src]

impl<T, U> TryFrom<U> for T where
    U: Into<T>, 
[src]

type Error = Infallible

The type returned in the event of a conversion error.

impl<T, U> TryInto<U> for T where
    U: TryFrom<T>, 
[src]

type Error = <U as TryFrom<T>>::Error

The type returned in the event of a conversion error.