pub struct ArcStatefulBiPredicate<T, U> { /* private fields */ }Expand description
An Arc-based stateful bi-predicate with thread-safe shared ownership.
This type stores the predicate closure inside Arc<Mutex<_>>, allowing
cheap clones that share mutable predicate state across threads.
Implementations§
Source§impl<T, U> ArcStatefulBiPredicate<T, U>
impl<T, U> ArcStatefulBiPredicate<T, U>
Sourcepub fn new<F>(f: F) -> Self
pub fn new<F>(f: F) -> Self
Creates a new bi-predicate.
Wraps the provided closure in the appropriate smart pointer type for this bi-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 bi-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 bi-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 bi-predicate.
Sourcepub fn always_true() -> Self
pub fn always_true() -> Self
Creates a bi-predicate that always returns true.
§Returns
A new ArcStatefulBiPredicate that always returns true.
Sourcepub fn always_false() -> Self
pub fn always_false() -> Self
Creates a bi-predicate that always returns false.
§Returns
A new ArcStatefulBiPredicate that always returns false.
Sourcepub fn and<P>(&self, other: P) -> ArcStatefulBiPredicate<T, U>where
P: StatefulBiPredicate<T, U> + Send + 'static,
T: 'static,
U: 'static,
pub fn and<P>(&self, other: P) -> ArcStatefulBiPredicate<T, U>where
P: StatefulBiPredicate<T, U> + Send + 'static,
T: 'static,
U: 'static,
Returns a bi-predicate representing logical AND with another predicate.
This method borrows self; the returned predicate shares this
predicate’s mutable state through the same Arc<Mutex<_>>.
§Parameters
other- The other bi-predicate to combine with.
§Returns
A new ArcStatefulBiPredicate representing logical AND.
Sourcepub fn or<P>(&self, other: P) -> ArcStatefulBiPredicate<T, U>where
P: StatefulBiPredicate<T, U> + Send + 'static,
T: 'static,
U: 'static,
pub fn or<P>(&self, other: P) -> ArcStatefulBiPredicate<T, U>where
P: StatefulBiPredicate<T, U> + Send + 'static,
T: 'static,
U: 'static,
Returns a bi-predicate representing logical OR with another predicate.
This method borrows self; the returned predicate shares this
predicate’s mutable state through the same Arc<Mutex<_>>.
§Parameters
other- The other bi-predicate to combine with.
§Returns
A new ArcStatefulBiPredicate representing logical OR.
Sourcepub fn nand<P>(&self, other: P) -> ArcStatefulBiPredicate<T, U>where
P: StatefulBiPredicate<T, U> + Send + 'static,
T: 'static,
U: 'static,
pub fn nand<P>(&self, other: P) -> ArcStatefulBiPredicate<T, U>where
P: StatefulBiPredicate<T, U> + Send + 'static,
T: 'static,
U: 'static,
Sourcepub fn xor<P>(&self, other: P) -> ArcStatefulBiPredicate<T, U>where
P: StatefulBiPredicate<T, U> + Send + 'static,
T: 'static,
U: 'static,
pub fn xor<P>(&self, other: P) -> ArcStatefulBiPredicate<T, U>where
P: StatefulBiPredicate<T, U> + Send + 'static,
T: 'static,
U: 'static,
Sourcepub fn nor<P>(&self, other: P) -> ArcStatefulBiPredicate<T, U>where
P: StatefulBiPredicate<T, U> + Send + 'static,
T: 'static,
U: 'static,
pub fn nor<P>(&self, other: P) -> ArcStatefulBiPredicate<T, U>where
P: StatefulBiPredicate<T, U> + Send + 'static,
T: 'static,
U: 'static,
Trait Implementations§
Source§impl<T, U> Clone for ArcStatefulBiPredicate<T, U>
impl<T, U> Clone for ArcStatefulBiPredicate<T, U>
Source§impl<T, U> Debug for ArcStatefulBiPredicate<T, U>
impl<T, U> Debug for ArcStatefulBiPredicate<T, U>
Source§impl<T, U> Display for ArcStatefulBiPredicate<T, U>
impl<T, U> Display for ArcStatefulBiPredicate<T, U>
Source§impl<T, U> Not for &ArcStatefulBiPredicate<T, U>where
T: 'static,
U: 'static,
impl<T, U> Not for &ArcStatefulBiPredicate<T, U>where
T: 'static,
U: 'static,
Source§impl<T, U> Not for ArcStatefulBiPredicate<T, U>where
T: 'static,
U: 'static,
impl<T, U> Not for ArcStatefulBiPredicate<T, U>where
T: 'static,
U: 'static,
Source§impl<T, U> StatefulBiPredicate<T, U> for ArcStatefulBiPredicate<T, U>
impl<T, U> StatefulBiPredicate<T, U> for ArcStatefulBiPredicate<T, U>
Source§fn test(&mut self, first: &T, second: &U) -> bool
fn test(&mut self, first: &T, second: &U) -> bool
Source§fn into_box(self) -> BoxStatefulBiPredicate<T, U>where
Self: 'static,
fn into_box(self) -> BoxStatefulBiPredicate<T, U>where
Self: 'static,
BoxStatefulBiPredicate. Read moreSource§fn into_rc(self) -> RcStatefulBiPredicate<T, U>where
Self: 'static,
fn into_rc(self) -> RcStatefulBiPredicate<T, U>where
Self: 'static,
RcStatefulBiPredicate. Read moreSource§fn into_arc(self) -> ArcStatefulBiPredicate<T, U>
fn into_arc(self) -> ArcStatefulBiPredicate<T, U>
ArcStatefulBiPredicate. Read moreSource§fn into_fn(self) -> impl FnMut(&T, &U) -> bool
fn into_fn(self) -> impl FnMut(&T, &U) -> bool
FnMut(&T, &U) -> bool. Read moreSource§fn to_box(&self) -> BoxStatefulBiPredicate<T, U>where
Self: 'static,
fn to_box(&self) -> BoxStatefulBiPredicate<T, U>where
Self: 'static,
BoxStatefulBiPredicate. Read moreSource§fn to_rc(&self) -> RcStatefulBiPredicate<T, U>where
Self: 'static,
fn to_rc(&self) -> RcStatefulBiPredicate<T, U>where
Self: 'static,
RcStatefulBiPredicate. Read moreSource§fn to_arc(&self) -> ArcStatefulBiPredicate<T, U>
fn to_arc(&self) -> ArcStatefulBiPredicate<T, U>
ArcStatefulBiPredicate. Read more