Struct ruma::events::room::power_levels::RoomPowerLevels
source · [−]#[non_exhaustive]pub struct RoomPowerLevels {
pub ban: Int,
pub events: BTreeMap<RoomEventType, Int, Global>,
pub events_default: Int,
pub invite: Int,
pub kick: Int,
pub redact: Int,
pub state_default: Int,
pub users: BTreeMap<OwnedUserId, Int, Global>,
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: IntThe level required to ban a user.
events: BTreeMap<RoomEventType, Int, Global>The level required to send specific event types.
This is a mapping from event type to power level required.
events_default: IntThe default level required to send message events.
invite: IntThe level required to invite a user.
kick: IntThe level required to kick a user.
redact: IntThe level required to redact an event.
state_default: IntThe default level required to send state events.
users: BTreeMap<OwnedUserId, Int, Global>The power levels for specific users.
This is a mapping from user_id to power level for that user.
users_default: IntThe default power level for every user in the room.
notifications: NotificationPowerLevelsThe 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) -> RoomPowerLevels
fn from(c: RedactedRoomPowerLevelsEventContent) -> RoomPowerLevels
Converts to this type from the input type.
sourceimpl From<RoomPowerLevels> for RoomPowerLevelsEventContent
impl From<RoomPowerLevels> for RoomPowerLevelsEventContent
sourcefn from(c: RoomPowerLevels) -> RoomPowerLevelsEventContent
fn from(c: RoomPowerLevels) -> RoomPowerLevelsEventContent
Converts to this type from the input type.
sourceimpl From<RoomPowerLevelsEventContent> for RoomPowerLevels
impl From<RoomPowerLevelsEventContent> for RoomPowerLevels
sourcefn from(c: RoomPowerLevelsEventContent) -> RoomPowerLevels
fn from(c: RoomPowerLevelsEventContent) -> RoomPowerLevels
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
