pub struct RoomMemberships(/* private fields */);
Expand description
Room membership filter as a bitset.
Note that RoomMemberships::empty()
doesn’t filter the results and
RoomMemberships::all()
filters out unknown memberships.
Implementations§
Source§impl RoomMemberships
impl RoomMemberships
Sourcepub const JOIN: RoomMemberships = _
pub const JOIN: RoomMemberships = _
The member joined the room.
Sourcepub const INVITE: RoomMemberships = _
pub const INVITE: RoomMemberships = _
The member was invited to the room.
Sourcepub const KNOCK: RoomMemberships = _
pub const KNOCK: RoomMemberships = _
The member requested to join the room.
Sourcepub const LEAVE: RoomMemberships = _
pub const LEAVE: RoomMemberships = _
The member left the room.
Sourcepub const BAN: RoomMemberships = _
pub const BAN: RoomMemberships = _
The member was banned.
Sourcepub const ACTIVE: RoomMemberships = _
pub const ACTIVE: RoomMemberships = _
The member is active in the room (i.e. joined or invited).
Source§impl RoomMemberships
impl RoomMemberships
Sourcepub const fn empty() -> RoomMemberships
pub const fn empty() -> RoomMemberships
Get a flags value with all bits unset.
Sourcepub const fn all() -> RoomMemberships
pub const fn all() -> RoomMemberships
Get a flags value with all known bits set.
Sourcepub const fn bits(&self) -> u16
pub const fn bits(&self) -> u16
Get the underlying bits value.
The returned value is exactly the bits set in this flags value.
Sourcepub const fn from_bits(bits: u16) -> Option<RoomMemberships>
pub const fn from_bits(bits: u16) -> Option<RoomMemberships>
Convert from a bits value.
This method will return None
if any unknown bits are set.
Sourcepub const fn from_bits_truncate(bits: u16) -> RoomMemberships
pub const fn from_bits_truncate(bits: u16) -> RoomMemberships
Convert from a bits value, unsetting any unknown bits.
Sourcepub const fn from_bits_retain(bits: u16) -> RoomMemberships
pub const fn from_bits_retain(bits: u16) -> RoomMemberships
Convert from a bits value exactly.
Sourcepub fn from_name(name: &str) -> Option<RoomMemberships>
pub fn from_name(name: &str) -> Option<RoomMemberships>
Get a flags value with the bits of a flag with the given name set.
This method will return None
if name
is empty or doesn’t
correspond to any named flag.
Sourcepub const fn intersects(&self, other: RoomMemberships) -> bool
pub const fn intersects(&self, other: RoomMemberships) -> bool
Whether any set bits in a source flags value are also set in a target flags value.
Sourcepub const fn contains(&self, other: RoomMemberships) -> bool
pub const fn contains(&self, other: RoomMemberships) -> bool
Whether all set bits in a source flags value are also set in a target flags value.
Sourcepub fn insert(&mut self, other: RoomMemberships)
pub fn insert(&mut self, other: RoomMemberships)
The bitwise or (|
) of the bits in two flags values.
Sourcepub fn remove(&mut self, other: RoomMemberships)
pub fn remove(&mut self, other: RoomMemberships)
The intersection of a source flags value with the complement of a target flags value (&!
).
This method is not equivalent to self & !other
when other
has unknown bits set.
remove
won’t truncate other
, but the !
operator will.
Sourcepub fn toggle(&mut self, other: RoomMemberships)
pub fn toggle(&mut self, other: RoomMemberships)
The bitwise exclusive-or (^
) of the bits in two flags values.
Sourcepub fn set(&mut self, other: RoomMemberships, value: bool)
pub fn set(&mut self, other: RoomMemberships, value: bool)
Call insert
when value
is true
or remove
when value
is false
.
Sourcepub const fn intersection(self, other: RoomMemberships) -> RoomMemberships
pub const fn intersection(self, other: RoomMemberships) -> RoomMemberships
The bitwise and (&
) of the bits in two flags values.
Sourcepub const fn union(self, other: RoomMemberships) -> RoomMemberships
pub const fn union(self, other: RoomMemberships) -> RoomMemberships
The bitwise or (|
) of the bits in two flags values.
Sourcepub const fn difference(self, other: RoomMemberships) -> RoomMemberships
pub const fn difference(self, other: RoomMemberships) -> RoomMemberships
The intersection of a source flags value with the complement of a target flags value (&!
).
This method is not equivalent to self & !other
when other
has unknown bits set.
difference
won’t truncate other
, but the !
operator will.
Sourcepub const fn symmetric_difference(
self,
other: RoomMemberships,
) -> RoomMemberships
pub const fn symmetric_difference( self, other: RoomMemberships, ) -> RoomMemberships
The bitwise exclusive-or (^
) of the bits in two flags values.
Sourcepub const fn complement(self) -> RoomMemberships
pub const fn complement(self) -> RoomMemberships
The bitwise negation (!
) of the bits in a flags value, truncating the result.
Source§impl RoomMemberships
impl RoomMemberships
Sourcepub const fn iter(&self) -> Iter<RoomMemberships>
pub const fn iter(&self) -> Iter<RoomMemberships>
Yield a set of contained flags values.
Each yielded flags value will correspond to a defined named flag. Any unknown bits will be yielded together as a final flags value.
Sourcepub const fn iter_names(&self) -> IterNames<RoomMemberships>
pub const fn iter_names(&self) -> IterNames<RoomMemberships>
Yield a set of contained named flags values.
This method is like iter
, except only yields bits in contained named flags.
Any unknown bits, or bits not corresponding to a contained flag will not be yielded.
Source§impl RoomMemberships
impl RoomMemberships
Sourcepub fn matches(&self, membership: &MembershipState) -> bool
pub fn matches(&self, membership: &MembershipState) -> bool
Whether the given membership matches this RoomMemberships
.
Sourcepub fn as_vec(&self) -> Vec<MembershipState>
pub fn as_vec(&self) -> Vec<MembershipState>
Get this RoomMemberships
as a list of matching MembershipState
s.
Trait Implementations§
Source§impl Binary for RoomMemberships
impl Binary for RoomMemberships
Source§impl BitAnd for RoomMemberships
impl BitAnd for RoomMemberships
Source§fn bitand(self, other: RoomMemberships) -> RoomMemberships
fn bitand(self, other: RoomMemberships) -> RoomMemberships
The bitwise and (&
) of the bits in two flags values.
Source§type Output = RoomMemberships
type Output = RoomMemberships
&
operator.Source§impl BitAndAssign for RoomMemberships
impl BitAndAssign for RoomMemberships
Source§fn bitand_assign(&mut self, other: RoomMemberships)
fn bitand_assign(&mut self, other: RoomMemberships)
The bitwise and (&
) of the bits in two flags values.
Source§impl BitOr for RoomMemberships
impl BitOr for RoomMemberships
Source§fn bitor(self, other: RoomMemberships) -> RoomMemberships
fn bitor(self, other: RoomMemberships) -> RoomMemberships
The bitwise or (|
) of the bits in two flags values.
Source§type Output = RoomMemberships
type Output = RoomMemberships
|
operator.Source§impl BitOrAssign for RoomMemberships
impl BitOrAssign for RoomMemberships
Source§fn bitor_assign(&mut self, other: RoomMemberships)
fn bitor_assign(&mut self, other: RoomMemberships)
The bitwise or (|
) of the bits in two flags values.
Source§impl BitXor for RoomMemberships
impl BitXor for RoomMemberships
Source§fn bitxor(self, other: RoomMemberships) -> RoomMemberships
fn bitxor(self, other: RoomMemberships) -> RoomMemberships
The bitwise exclusive-or (^
) of the bits in two flags values.
Source§type Output = RoomMemberships
type Output = RoomMemberships
^
operator.Source§impl BitXorAssign for RoomMemberships
impl BitXorAssign for RoomMemberships
Source§fn bitxor_assign(&mut self, other: RoomMemberships)
fn bitxor_assign(&mut self, other: RoomMemberships)
The bitwise exclusive-or (^
) of the bits in two flags values.
Source§impl Clone for RoomMemberships
impl Clone for RoomMemberships
Source§fn clone(&self) -> RoomMemberships
fn clone(&self) -> RoomMemberships
1.0.0 · Source§fn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
source
. Read moreSource§impl Debug for RoomMemberships
impl Debug for RoomMemberships
Source§impl Extend<RoomMemberships> for RoomMemberships
impl Extend<RoomMemberships> for RoomMemberships
Source§fn extend<T>(&mut self, iterator: T)where
T: IntoIterator<Item = RoomMemberships>,
fn extend<T>(&mut self, iterator: T)where
T: IntoIterator<Item = RoomMemberships>,
The bitwise or (|
) of the bits in each flags value.
Source§fn extend_one(&mut self, item: A)
fn extend_one(&mut self, item: A)
extend_one
)Source§fn extend_reserve(&mut self, additional: usize)
fn extend_reserve(&mut self, additional: usize)
extend_one
)Source§impl Flags for RoomMemberships
impl Flags for RoomMemberships
Source§const FLAGS: &'static [Flag<RoomMemberships>] = _
const FLAGS: &'static [Flag<RoomMemberships>] = _
Source§fn from_bits_retain(bits: u16) -> RoomMemberships
fn from_bits_retain(bits: u16) -> RoomMemberships
Source§fn from_bits_truncate(bits: Self::Bits) -> Self
fn from_bits_truncate(bits: Self::Bits) -> Self
Source§fn from_name(name: &str) -> Option<Self>
fn from_name(name: &str) -> Option<Self>
Source§fn iter_names(&self) -> IterNames<Self>
fn iter_names(&self) -> IterNames<Self>
Source§fn intersects(&self, other: Self) -> boolwhere
Self: Sized,
fn intersects(&self, other: Self) -> boolwhere
Self: Sized,
Source§fn contains(&self, other: Self) -> boolwhere
Self: Sized,
fn contains(&self, other: Self) -> boolwhere
Self: Sized,
Source§fn insert(&mut self, other: Self)where
Self: Sized,
fn insert(&mut self, other: Self)where
Self: Sized,
|
) of the bits in two flags values.Source§fn remove(&mut self, other: Self)where
Self: Sized,
fn remove(&mut self, other: Self)where
Self: Sized,
&!
). Read moreSource§fn toggle(&mut self, other: Self)where
Self: Sized,
fn toggle(&mut self, other: Self)where
Self: Sized,
^
) of the bits in two flags values.Source§fn intersection(self, other: Self) -> Self
fn intersection(self, other: Self) -> Self
&
) of the bits in two flags values.Source§fn difference(self, other: Self) -> Self
fn difference(self, other: Self) -> Self
&!
). Read moreSource§fn symmetric_difference(self, other: Self) -> Self
fn symmetric_difference(self, other: Self) -> Self
^
) of the bits in two flags values.Source§fn complement(self) -> Self
fn complement(self) -> Self
!
) of the bits in a flags value, truncating the result.Source§impl FromIterator<RoomMemberships> for RoomMemberships
impl FromIterator<RoomMemberships> for RoomMemberships
Source§fn from_iter<T>(iterator: T) -> RoomMembershipswhere
T: IntoIterator<Item = RoomMemberships>,
fn from_iter<T>(iterator: T) -> RoomMembershipswhere
T: IntoIterator<Item = RoomMemberships>,
The bitwise or (|
) of the bits in each flags value.
Source§impl Hash for RoomMemberships
impl Hash for RoomMemberships
Source§impl IntoIterator for RoomMemberships
impl IntoIterator for RoomMemberships
Source§type Item = RoomMemberships
type Item = RoomMemberships
Source§type IntoIter = Iter<RoomMemberships>
type IntoIter = Iter<RoomMemberships>
Source§fn into_iter(self) -> <RoomMemberships as IntoIterator>::IntoIter
fn into_iter(self) -> <RoomMemberships as IntoIterator>::IntoIter
Source§impl LowerHex for RoomMemberships
impl LowerHex for RoomMemberships
Source§impl Not for RoomMemberships
impl Not for RoomMemberships
Source§fn not(self) -> RoomMemberships
fn not(self) -> RoomMemberships
The bitwise negation (!
) of the bits in a flags value, truncating the result.
Source§type Output = RoomMemberships
type Output = RoomMemberships
!
operator.Source§impl Octal for RoomMemberships
impl Octal for RoomMemberships
Source§impl PartialEq for RoomMemberships
impl PartialEq for RoomMemberships
Source§impl Sub for RoomMemberships
impl Sub for RoomMemberships
Source§fn sub(self, other: RoomMemberships) -> RoomMemberships
fn sub(self, other: RoomMemberships) -> RoomMemberships
The intersection of a source flags value with the complement of a target flags value (&!
).
This method is not equivalent to self & !other
when other
has unknown bits set.
difference
won’t truncate other
, but the !
operator will.
Source§type Output = RoomMemberships
type Output = RoomMemberships
-
operator.Source§impl SubAssign for RoomMemberships
impl SubAssign for RoomMemberships
Source§fn sub_assign(&mut self, other: RoomMemberships)
fn sub_assign(&mut self, other: RoomMemberships)
The intersection of a source flags value with the complement of a target flags value (&!
).
This method is not equivalent to self & !other
when other
has unknown bits set.
difference
won’t truncate other
, but the !
operator will.
Source§impl UpperHex for RoomMemberships
impl UpperHex for RoomMemberships
impl Copy for RoomMemberships
impl Eq for RoomMemberships
impl StructuralPartialEq for RoomMemberships
Auto Trait Implementations§
impl Freeze for RoomMemberships
impl RefUnwindSafe for RoomMemberships
impl Send for RoomMemberships
impl Sync for RoomMemberships
impl Unpin for RoomMemberships
impl UnwindSafe for RoomMemberships
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
Source§impl<T> CloneToUninit for Twhere
T: Clone,
impl<T> CloneToUninit for Twhere
T: Clone,
§impl<T> CompatExt for T
impl<T> CompatExt for T
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§fn equivalent(&self, key: &K) -> bool
fn equivalent(&self, key: &K) -> bool
key
and return true
if they are equal.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
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<T> FutureExt for T
impl<T> FutureExt for T
Source§fn with_context(self, otel_cx: Context) -> WithContext<Self>
fn with_context(self, otel_cx: Context) -> WithContext<Self>
Source§fn with_current_context(self) -> WithContext<Self>
fn with_current_context(self) -> WithContext<Self>
Source§impl<T, UT> HandleAlloc<UT> for T
impl<T, UT> HandleAlloc<UT> for T
Source§fn consume_handle(handle: Handle) -> Arc<T>
fn consume_handle(handle: Handle) -> Arc<T>
Arc<>
Source§impl<T, W> HasTypeWitness<W> for Twhere
W: MakeTypeWitness<Arg = T>,
T: ?Sized,
impl<T, W> HasTypeWitness<W> for Twhere
W: MakeTypeWitness<Arg = T>,
T: ?Sized,
Source§impl<T> Identity for Twhere
T: ?Sized,
impl<T> Identity for Twhere
T: ?Sized,
§impl<T> Instrument for T
impl<T> Instrument for T
§fn instrument(self, span: Span) -> Instrumented<Self>
fn instrument(self, span: Span) -> Instrumented<Self>
§fn in_current_span(self) -> Instrumented<Self>
fn in_current_span(self) -> Instrumented<Self>
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>
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>
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 more