Struct matrix_sdk::RoomMemberships
source · 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.
§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.
§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.
§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
§type Item = RoomMemberships
type Item = RoomMemberships
§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.
§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§fn eq(&self, other: &RoomMemberships) -> bool
fn eq(&self, other: &RoomMemberships) -> bool
self
and other
values to be equal, and is used
by ==
.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.
§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,
source§default unsafe fn clone_to_uninit(&self, dst: *mut T)
default unsafe fn clone_to_uninit(&self, dst: *mut T)
clone_to_uninit
)source§impl<T> CloneToUninit for Twhere
T: Copy,
impl<T> CloneToUninit for Twhere
T: Copy,
source§unsafe fn clone_to_uninit(&self, dst: *mut T)
unsafe fn clone_to_uninit(&self, dst: *mut T)
clone_to_uninit
)§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