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

Predicate that wraps a function over a reference that returns a bool. This type is returned by the predicate::function function.

Implementations

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

Returns a copy of the value. Read more

Performs copy-assignment from source. Read more

Formats the value using the given formatter. Read more

Formats the value using the given formatter. Read more

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

This method tests for !=.

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

Find a case that proves this predicate as expected when run against variable.

Parameters of the current Predicate.

Nested Predicates of the current Predicate.

Auto Trait Implementations

Blanket Implementations

Gets the TypeId of self. Read more

Immutably borrows from an owned value. Read more

Mutably borrows from an owned value. Read more

Performs the conversion.

Performs the conversion.

Compute the logical AND of two Predicate results, returning the result. Read more

Compute the logical OR of two Predicate results, returning the result. Read more

Compute the logical NOT of a Predicate, returning the result. Read more

Name a predicate expression. Read more

The resulting type after obtaining ownership.

Creates owned data from borrowed data, usually by cloning. Read more

🔬 This is a nightly-only experimental API. (toowned_clone_into)

Uses borrowed data to replace owned data, usually by cloning. Read more

Converts the given value to a String. Read more

The type returned in the event of a conversion error.

Performs the conversion.

The type returned in the event of a conversion error.

Performs the conversion.