Struct ruma_common::events::room::power_levels::RoomPowerLevels
source · [−]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,
}
events
only.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
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
1.0.0 · sourcefn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
source
. Read more