Struct ruma_common::events::room::power_levels::RoomPowerLevels
source · [−]#[non_exhaustive]pub struct RoomPowerLevels {
pub ban: Int,
pub events: BTreeMap<RoomEventType, Int>,
pub events_default: Int,
pub invite: Int,
pub kick: Int,
pub redact: Int,
pub state_default: Int,
pub users: BTreeMap<OwnedUserId, Int>,
pub users_default: Int,
pub notifications: NotificationPowerLevels,
}
Expand description
The effective power levels of a room.
This struct contains the same fields as RoomPowerLevelsEventContent
and be created from that
using a From
trait implementation, but it is also implements
From<
RedactedRoomPowerLevelsEventContent
>
, so can be used when wanting to inspect the
power levels of a room, regardless of whether the most recent power-levels event is redacted or
not.
Fields (Non-exhaustive)
This struct is marked as non-exhaustive
Struct { .. }
syntax; cannot be matched against without a wildcard ..
; and struct update syntax will not work.ban: Int
The level required to ban a user.
events: BTreeMap<RoomEventType, Int>
The level required to send specific event types.
This is a mapping from event type to power level required.
events_default: Int
The default level required to send message events.
invite: Int
The level required to invite a user.
kick: Int
The level required to kick a user.
redact: Int
The level required to redact an event.
state_default: Int
The default level required to send state events.
users: BTreeMap<OwnedUserId, Int>
The power levels for specific users.
This is a mapping from user_id
to power level for that user.
users_default: Int
The default power level for every user in the room.
notifications: NotificationPowerLevels
The power level requirements for specific notification types.
This is a mapping from key
to power level for that notifications key.
Implementations
sourceimpl RoomPowerLevels
impl RoomPowerLevels
sourcepub fn user_can_do(&self, user_id: &UserId, action: PowerLevelAction) -> bool
pub fn user_can_do(&self, user_id: &UserId, action: PowerLevelAction) -> bool
Whether the given user can do the given action based on the power levels.
Trait Implementations
sourceimpl Clone for RoomPowerLevels
impl Clone for RoomPowerLevels
sourcefn clone(&self) -> RoomPowerLevels
fn clone(&self) -> RoomPowerLevels
Returns a copy of the value. Read more
1.0.0 · sourcefn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
Performs copy-assignment from source
. Read more
sourceimpl Debug for RoomPowerLevels
impl Debug for RoomPowerLevels
sourceimpl From<RedactedRoomPowerLevelsEventContent> for RoomPowerLevels
impl From<RedactedRoomPowerLevelsEventContent> for RoomPowerLevels
sourcefn from(c: RedactedRoomPowerLevelsEventContent) -> Self
fn from(c: RedactedRoomPowerLevelsEventContent) -> Self
Converts to this type from the input type.
sourceimpl From<RoomPowerLevels> for RoomPowerLevelsEventContent
impl From<RoomPowerLevels> for RoomPowerLevelsEventContent
sourcefn from(c: RoomPowerLevels) -> Self
fn from(c: RoomPowerLevels) -> Self
Converts to this type from the input type.
sourceimpl From<RoomPowerLevelsEventContent> for RoomPowerLevels
impl From<RoomPowerLevelsEventContent> for RoomPowerLevels
sourcefn from(c: RoomPowerLevelsEventContent) -> Self
fn from(c: RoomPowerLevelsEventContent) -> Self
Converts to this type from the input type.
Auto Trait Implementations
impl RefUnwindSafe for RoomPowerLevels
impl Send for RoomPowerLevels
impl Sync for RoomPowerLevels
impl Unpin for RoomPowerLevels
impl UnwindSafe for RoomPowerLevels
Blanket Implementations
sourceimpl<T> BorrowMut<T> for T where
T: ?Sized,
impl<T> BorrowMut<T> for T where
T: ?Sized,
const: unstable · sourcefn borrow_mut(&mut self) -> &mut T
fn borrow_mut(&mut self) -> &mut T
Mutably borrows from an owned value. Read more
sourceimpl<T> Instrument for T
impl<T> Instrument for T
sourcefn instrument(self, span: Span) -> Instrumented<Self>
fn instrument(self, span: Span) -> Instrumented<Self>
sourcefn in_current_span(self) -> Instrumented<Self>
fn in_current_span(self) -> Instrumented<Self>
sourceimpl<T> WithSubscriber for T
impl<T> WithSubscriber for T
sourcefn with_subscriber<S>(self, subscriber: S) -> WithDispatch<Self> where
S: Into<Dispatch>,
fn with_subscriber<S>(self, subscriber: S) -> WithDispatch<Self> where
S: Into<Dispatch>,
Attaches the provided Subscriber
to this type, returning a
WithDispatch
wrapper. Read more
sourcefn with_current_subscriber(self) -> WithDispatch<Self>
fn with_current_subscriber(self) -> WithDispatch<Self>
Attaches the current default Subscriber
to this type, returning a
WithDispatch
wrapper. Read more