#[repr(C)]pub struct InteractionGroups {
pub memberships: Group,
pub filter: Group,
}Expand description
Pairwise filtering using bit masks.
This filtering method is based on two 32-bit values:
- The interaction groups memberships.
- The interaction groups filter.
An interaction is allowed between two filters a and b when two conditions
are met simultaneously:
- The groups membership of
ahas at least one bit set to1in common with the groups filter ofb. - The groups membership of
bhas at least one bit set to1in common with the groups filter ofa.
In other words, interactions are allowed between two filter iff. the following condition is met:
ⓘ
(self.memberships & rhs.filter) != 0 && (rhs.memberships & self.filter) != 0Fields§
§memberships: GroupGroups memberships.
filter: GroupGroups filter.
Implementations§
Source§impl InteractionGroups
impl InteractionGroups
Sourcepub const fn new(memberships: Group, filter: Group) -> InteractionGroups
pub const fn new(memberships: Group, filter: Group) -> InteractionGroups
Initializes with the given interaction groups and interaction mask.
Sourcepub const fn all() -> InteractionGroups
pub const fn all() -> InteractionGroups
Allow interaction with everything.
Sourcepub const fn none() -> InteractionGroups
pub const fn none() -> InteractionGroups
Prevent all interactions.
Sourcepub const fn with_memberships(self, memberships: Group) -> InteractionGroups
pub const fn with_memberships(self, memberships: Group) -> InteractionGroups
Sets the group this filter is part of.
Sourcepub const fn with_filter(self, filter: Group) -> InteractionGroups
pub const fn with_filter(self, filter: Group) -> InteractionGroups
Sets the interaction mask of this filter.
Sourcepub const fn test(self, rhs: InteractionGroups) -> bool
pub const fn test(self, rhs: InteractionGroups) -> bool
Check if interactions should be allowed based on the interaction memberships and filter.
An interaction is allowed iff. the memberships of self contain at least one bit set to 1 in common
with the filter of rhs, and vice-versa.
Trait Implementations§
Source§impl Clone for InteractionGroups
impl Clone for InteractionGroups
Source§fn clone(&self) -> InteractionGroups
fn clone(&self) -> InteractionGroups
Returns a duplicate of the value. Read more
1.0.0 · Source§fn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
Performs copy-assignment from
source. Read moreSource§impl Debug for InteractionGroups
impl Debug for InteractionGroups
Source§impl Default for InteractionGroups
impl Default for InteractionGroups
Source§fn default() -> InteractionGroups
fn default() -> InteractionGroups
Returns the “default value” for a type. Read more
Source§impl<'a> From<InteractionGroups> for QueryFilter<'a>
impl<'a> From<InteractionGroups> for QueryFilter<'a>
Source§fn from(groups: InteractionGroups) -> QueryFilter<'a>
fn from(groups: InteractionGroups) -> QueryFilter<'a>
Converts to this type from the input type.
Source§impl Hash for InteractionGroups
impl Hash for InteractionGroups
Source§impl PartialEq for InteractionGroups
impl PartialEq for InteractionGroups
impl Copy for InteractionGroups
impl Eq for InteractionGroups
impl StructuralPartialEq for InteractionGroups
Auto Trait Implementations§
impl Freeze for InteractionGroups
impl RefUnwindSafe for InteractionGroups
impl Send for InteractionGroups
impl Sync for InteractionGroups
impl Unpin for InteractionGroups
impl UnwindSafe for InteractionGroups
Blanket Implementations§
Source§impl<T> BorrowMut<T> for Twhere
T: ?Sized,
impl<T> BorrowMut<T> for Twhere
T: ?Sized,
Source§fn borrow_mut(&mut self) -> &mut T
fn borrow_mut(&mut self) -> &mut T
Mutably borrows from an owned value. Read more
Source§impl<T> CallHasher for T
impl<T> CallHasher for T
Source§impl<T> CloneToUninit for Twhere
T: Clone,
impl<T> CloneToUninit for Twhere
T: Clone,
Source§impl<T> Downcast for Twhere
T: Any,
impl<T> Downcast for Twhere
T: Any,
Source§fn into_any(self: Box<T>) -> Box<dyn Any>
fn into_any(self: Box<T>) -> Box<dyn Any>
Convert
Box<dyn Trait> (where Trait: Downcast) to Box<dyn Any>. Box<dyn Any> can
then be further downcast into Box<ConcreteType> where ConcreteType implements Trait.Source§fn into_any_rc(self: Rc<T>) -> Rc<dyn Any>
fn into_any_rc(self: Rc<T>) -> Rc<dyn Any>
Convert
Rc<Trait> (where Trait: Downcast) to Rc<Any>. Rc<Any> can then be
further downcast into Rc<ConcreteType> where ConcreteType implements Trait.Source§fn as_any(&self) -> &(dyn Any + 'static)
fn as_any(&self) -> &(dyn Any + 'static)
Convert
&Trait (where Trait: Downcast) to &Any. This is needed since Rust cannot
generate &Any’s vtable from &Trait’s.Source§fn as_any_mut(&mut self) -> &mut (dyn Any + 'static)
fn as_any_mut(&mut self) -> &mut (dyn Any + 'static)
Convert
&mut Trait (where Trait: Downcast) to &Any. This is needed since Rust cannot
generate &mut Any’s vtable from &mut Trait’s.Source§impl<T> DowncastSync for T
impl<T> DowncastSync for T
Source§impl<Q, K> Equivalent<K> for Q
impl<Q, K> Equivalent<K> for Q
Source§fn equivalent(&self, key: &K) -> bool
fn equivalent(&self, key: &K) -> bool
Compare self to
key and return true if they are equal.Source§impl<Q, K> Equivalent<K> for Q
impl<Q, K> Equivalent<K> for Q
Source§impl<Q, K> Equivalent<K> for Q
impl<Q, K> Equivalent<K> for Q
Source§impl<T> IntoEither for T
impl<T> IntoEither for T
Source§fn into_either(self, into_left: bool) -> Either<Self, Self>
fn into_either(self, into_left: bool) -> Either<Self, Self>
Converts
self into a Left variant of Either<Self, Self>
if into_left is true.
Converts self into a Right variant of Either<Self, Self>
otherwise. Read moreSource§fn into_either_with<F>(self, into_left: F) -> Either<Self, Self>
fn into_either_with<F>(self, into_left: F) -> Either<Self, Self>
Converts
self into a Left variant of Either<Self, Self>
if into_left(&self) returns true.
Converts self into a Right variant of Either<Self, Self>
otherwise. Read moreSource§impl<T> Pointable for T
impl<T> Pointable for T
Source§impl<SS, SP> SupersetOf<SS> for SPwhere
SS: SubsetOf<SP>,
impl<SS, SP> SupersetOf<SS> for SPwhere
SS: SubsetOf<SP>,
Source§fn to_subset(&self) -> Option<SS>
fn to_subset(&self) -> Option<SS>
The inverse inclusion map: attempts to construct
self from the equivalent element of its
superset. Read moreSource§fn is_in_subset(&self) -> bool
fn is_in_subset(&self) -> bool
Checks if
self is actually part of its subset T (and can be converted to it).Source§fn to_subset_unchecked(&self) -> SS
fn to_subset_unchecked(&self) -> SS
Use with care! Same as
self.to_subset but without any property checks. Always succeeds.Source§fn from_subset(element: &SS) -> SP
fn from_subset(element: &SS) -> SP
The inclusion map: converts
self to the equivalent element of its superset.