Struct matrix_sdk_base::ruma::events::room::power_levels::RoomPowerLevels
#[non_exhaustive]pub struct RoomPowerLevels {
pub ban: Int,
pub events: BTreeMap<TimelineEventType, 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<TimelineEventType, 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§
§impl RoomPowerLevels
impl RoomPowerLevels
pub fn user_can_ban(&self, user_id: &UserId) -> bool
pub fn user_can_ban(&self, user_id: &UserId) -> bool
Whether the given user can ban other users based on the power levels.
Shorthand for power_levels.user_can_do(user_id, PowerLevelAction::Ban)
.
pub fn user_can_invite(&self, user_id: &UserId) -> bool
pub fn user_can_invite(&self, user_id: &UserId) -> bool
Whether the given user can invite other users based on the power levels.
Shorthand for power_levels.user_can_do(user_id, PowerLevelAction::Invite)
.
pub fn user_can_kick(&self, user_id: &UserId) -> bool
pub fn user_can_kick(&self, user_id: &UserId) -> bool
Whether the given user can kick other users based on the power levels.
Shorthand for power_levels.user_can_do(user_id, PowerLevelAction::Kick)
.
pub fn user_can_redact(&self, user_id: &UserId) -> bool
pub fn user_can_redact(&self, user_id: &UserId) -> bool
Whether the given user can redact events based on the power levels.
Shorthand for power_levels.user_can_do(user_id, PowerLevelAction::Redact)
.
pub fn user_can_send_message(
&self,
user_id: &UserId,
msg_type: MessageLikeEventType
) -> bool
pub fn user_can_send_message( &self, user_id: &UserId, msg_type: MessageLikeEventType ) -> bool
Whether the given user can send message events based on the power levels.
Shorthand for power_levels.user_can_do(user_id, PowerLevelAction::SendMessage(msg_type))
.
pub fn user_can_send_state(
&self,
user_id: &UserId,
state_type: StateEventType
) -> bool
pub fn user_can_send_state( &self, user_id: &UserId, state_type: StateEventType ) -> bool
Whether the given user can send state events based on the power levels.
Shorthand for power_levels.user_can_do(user_id, PowerLevelAction::SendState(state_type))
.
pub fn user_can_trigger_room_notification(&self, user_id: &UserId) -> bool
pub fn user_can_trigger_room_notification(&self, user_id: &UserId) -> bool
Whether the given user can notify everybody in the room by writing @room
in a message.
Shorthand for power_levels.user_can_do(user_id, PowerLevelAction::TriggerNotification(NotificationPowerLevelType::Room))
.
pub 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§
§impl Clone for RoomPowerLevels
impl Clone for RoomPowerLevels
§fn clone(&self) -> RoomPowerLevels
fn clone(&self) -> RoomPowerLevels
1.0.0 · source§fn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
source
. Read more