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.

Methods

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

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]

Returns a copy of the value. Read more

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: PartialEq, T> PartialEq for FnPredicate<F, T> where
    F: Fn(&T) -> bool,
    T: PartialEq + ?Sized
[src]

This method tests for self and other values to be equal, and is used by ==. Read more

This method tests for !=.

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

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

Execute this Predicate against variable, returning the resulting boolean. Read more

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]

Important traits for Box<R>

Parameters of the current Predicate.

Important traits for Box<R>

Nested Predicates of the current Predicate.

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

Formats the value using the given formatter. Read more

Auto Trait Implementations

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