pub struct BoxStatefulPredicate<T> { /* private fields */ }Expand description
A Box-based stateful predicate with single ownership.
This type stores a Box<dyn FnMut(&T) -> bool>, so each call may update
the predicate’s internal state. Composition methods consume self,
matching the single-ownership model.
Implementations§
Source§impl<T> BoxStatefulPredicate<T>
impl<T> BoxStatefulPredicate<T>
Sourcepub fn new<F>(f: F) -> Self
pub fn new<F>(f: F) -> Self
Creates a new predicate.
Wraps the provided closure in the appropriate smart pointer type for this predicate implementation.
Sourcepub fn new_with_name<F>(name: &str, f: F) -> Self
pub fn new_with_name<F>(name: &str, f: F) -> Self
Creates a new named predicate.
Wraps the provided closure and assigns it a name, which is useful for debugging and logging purposes.
Sourcepub fn new_with_optional_name<F>(f: F, name: Option<String>) -> Self
pub fn new_with_optional_name<F>(f: F, name: Option<String>) -> Self
Creates a new named predicate with an optional name.
Wraps the provided closure and assigns it an optional name.
Sourcepub fn clear_name(&mut self)
pub fn clear_name(&mut self)
Clears the name of this predicate.
Sourcepub fn always_true() -> Self
pub fn always_true() -> Self
Creates a predicate that always returns true.
§Returns
A new BoxStatefulPredicate that always returns true.
Sourcepub fn always_false() -> Self
pub fn always_false() -> Self
Creates a predicate that always returns false.
§Returns
A new BoxStatefulPredicate that always returns false.
Sourcepub fn and<P>(self, other: P) -> BoxStatefulPredicate<T>where
P: StatefulPredicate<T> + 'static,
T: 'static,
pub fn and<P>(self, other: P) -> BoxStatefulPredicate<T>where
P: StatefulPredicate<T> + 'static,
T: 'static,
Sourcepub fn or<P>(self, other: P) -> BoxStatefulPredicate<T>where
P: StatefulPredicate<T> + 'static,
T: 'static,
pub fn or<P>(self, other: P) -> BoxStatefulPredicate<T>where
P: StatefulPredicate<T> + 'static,
T: 'static,
Sourcepub fn nand<P>(self, other: P) -> BoxStatefulPredicate<T>where
P: StatefulPredicate<T> + 'static,
T: 'static,
pub fn nand<P>(self, other: P) -> BoxStatefulPredicate<T>where
P: StatefulPredicate<T> + 'static,
T: 'static,
Sourcepub fn xor<P>(self, other: P) -> BoxStatefulPredicate<T>where
P: StatefulPredicate<T> + 'static,
T: 'static,
pub fn xor<P>(self, other: P) -> BoxStatefulPredicate<T>where
P: StatefulPredicate<T> + 'static,
T: 'static,
Sourcepub fn nor<P>(self, other: P) -> BoxStatefulPredicate<T>where
P: StatefulPredicate<T> + 'static,
T: 'static,
pub fn nor<P>(self, other: P) -> BoxStatefulPredicate<T>where
P: StatefulPredicate<T> + 'static,
T: 'static,
Trait Implementations§
Source§impl<T> Debug for BoxStatefulPredicate<T>
impl<T> Debug for BoxStatefulPredicate<T>
Source§impl<T> Display for BoxStatefulPredicate<T>
impl<T> Display for BoxStatefulPredicate<T>
Source§impl<T> Not for BoxStatefulPredicate<T>where
T: 'static,
impl<T> Not for BoxStatefulPredicate<T>where
T: 'static,
Source§impl<T> StatefulPredicate<T> for BoxStatefulPredicate<T>
impl<T> StatefulPredicate<T> for BoxStatefulPredicate<T>
Source§fn test(&mut self, value: &T) -> bool
fn test(&mut self, value: &T) -> bool
Source§fn into_box(self) -> BoxStatefulPredicate<T>
fn into_box(self) -> BoxStatefulPredicate<T>
BoxStatefulPredicate. Read moreSource§fn into_rc(self) -> RcStatefulPredicate<T>where
Self: 'static,
fn into_rc(self) -> RcStatefulPredicate<T>where
Self: 'static,
RcStatefulPredicate. Read more