Skip to main content

FnStatefulBiPredicateOps

Trait FnStatefulBiPredicateOps 

Source
pub trait FnStatefulBiPredicateOps<T, U>: FnMut(&T, &U) -> bool + Sized {
    // Provided methods
    fn and<P>(self, other: P) -> BoxStatefulBiPredicate<T, U>
       where Self: 'static,
             P: StatefulBiPredicate<T, U> + 'static,
             T: 'static,
             U: 'static { ... }
    fn or<P>(self, other: P) -> BoxStatefulBiPredicate<T, U>
       where Self: 'static,
             P: StatefulBiPredicate<T, U> + 'static,
             T: 'static,
             U: 'static { ... }
    fn not(self) -> BoxStatefulBiPredicate<T, U>
       where Self: 'static,
             T: 'static,
             U: 'static { ... }
    fn nand<P>(self, other: P) -> BoxStatefulBiPredicate<T, U>
       where Self: 'static,
             P: StatefulBiPredicate<T, U> + 'static,
             T: 'static,
             U: 'static { ... }
    fn xor<P>(self, other: P) -> BoxStatefulBiPredicate<T, U>
       where Self: 'static,
             P: StatefulBiPredicate<T, U> + 'static,
             T: 'static,
             U: 'static { ... }
    fn nor<P>(self, other: P) -> BoxStatefulBiPredicate<T, U>
       where Self: 'static,
             P: StatefulBiPredicate<T, U> + 'static,
             T: 'static,
             U: 'static { ... }
}
Expand description

Extension trait providing logical composition methods for stateful closures.

This trait is implemented for closures and function objects matching FnMut(&T, &U) -> bool, allowing direct composition into BoxStatefulBiPredicate.

Provided Methods§

Source

fn and<P>(self, other: P) -> BoxStatefulBiPredicate<T, U>
where Self: 'static, P: StatefulBiPredicate<T, U> + 'static, T: 'static, U: 'static,

Returns a bi-predicate representing logical AND with another predicate.

This method consumes self and evaluates other only when this closure returns true.

§Parameters
  • other - The other bi-predicate to combine with.
§Returns

A BoxStatefulBiPredicate representing logical AND.

Source

fn or<P>(self, other: P) -> BoxStatefulBiPredicate<T, U>
where Self: 'static, P: StatefulBiPredicate<T, U> + 'static, T: 'static, U: 'static,

Returns a bi-predicate representing logical OR with another predicate.

This method consumes self and evaluates other only when this closure returns false.

§Parameters
  • other - The other bi-predicate to combine with.
§Returns

A BoxStatefulBiPredicate representing logical OR.

Source

fn not(self) -> BoxStatefulBiPredicate<T, U>
where Self: 'static, T: 'static, U: 'static,

Returns a bi-predicate representing logical negation.

This method consumes self and returns a predicate that negates the closure result.

§Returns

A BoxStatefulBiPredicate representing logical negation.

Source

fn nand<P>(self, other: P) -> BoxStatefulBiPredicate<T, U>
where Self: 'static, P: StatefulBiPredicate<T, U> + 'static, T: 'static, U: 'static,

Returns a bi-predicate representing logical NAND with another predicate.

NAND returns true unless both predicates return true.

§Parameters
  • other - The other bi-predicate to combine with.
§Returns

A BoxStatefulBiPredicate representing logical NAND.

Source

fn xor<P>(self, other: P) -> BoxStatefulBiPredicate<T, U>
where Self: 'static, P: StatefulBiPredicate<T, U> + 'static, T: 'static, U: 'static,

Returns a bi-predicate representing logical XOR with another predicate.

XOR evaluates both predicates and returns true when exactly one predicate returns true.

§Parameters
  • other - The other bi-predicate to combine with.
§Returns

A BoxStatefulBiPredicate representing logical XOR.

Source

fn nor<P>(self, other: P) -> BoxStatefulBiPredicate<T, U>
where Self: 'static, P: StatefulBiPredicate<T, U> + 'static, T: 'static, U: 'static,

Returns a bi-predicate representing logical NOR with another predicate.

NOR returns true only when both predicates return false.

§Parameters
  • other - The other bi-predicate to combine with.
§Returns

A BoxStatefulBiPredicate representing logical NOR.

Dyn Compatibility§

This trait is not dyn compatible.

In older versions of Rust, dyn compatibility was called "object safety", so this trait is not object safe.

Implementors§

Source§

impl<T, U, F> FnStatefulBiPredicateOps<T, U> for F
where F: FnMut(&T, &U) -> bool,