pub struct PLManager {
pub power_levels: PowerLevels,
}Expand description
Manages power levels for a Matrix room.
Provides convenience methods for checking and manipulating power levels
beyond what the raw PowerLevels struct offers.
Fields§
§power_levels: PowerLevelsImplementations§
Source§impl PLManager
impl PLManager
pub fn new(power_levels: PowerLevels) -> Self
Sourcepub fn user_level(&self, user_id: &str) -> i64
pub fn user_level(&self, user_id: &str) -> i64
Returns the effective power level of the given user.
Sourcepub fn can_send_event(&self, user_id: &str, event_type: &str) -> bool
pub fn can_send_event(&self, user_id: &str, event_type: &str) -> bool
Returns true if the user can send the given event type.
Sourcepub fn user_has_pl(&self, user_id: &str, required: i64) -> bool
pub fn user_has_pl(&self, user_id: &str, required: i64) -> bool
Returns true if the user has at least the given power level.
Sourcepub fn can_ban(&self, user_id: &str) -> bool
pub fn can_ban(&self, user_id: &str) -> bool
Returns true if the user can ban members from the room.
Sourcepub fn can_kick(&self, user_id: &str) -> bool
pub fn can_kick(&self, user_id: &str) -> bool
Returns true if the user can kick members from the room.
Sourcepub fn can_redact(&self, user_id: &str) -> bool
pub fn can_redact(&self, user_id: &str) -> bool
Returns true if the user can redact events.
Sourcepub fn can_invite(&self, user_id: &str) -> bool
pub fn can_invite(&self, user_id: &str) -> bool
Returns true if the user can invite members.
Sourcepub fn can_set_state(&self, user_id: &str) -> bool
pub fn can_set_state(&self, user_id: &str) -> bool
Returns true if the user can set state events.
Trait Implementations§
Auto Trait Implementations§
impl Freeze for PLManager
impl RefUnwindSafe for PLManager
impl Send for PLManager
impl Sync for PLManager
impl Unpin for PLManager
impl UnsafeUnpin for PLManager
impl UnwindSafe for PLManager
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
Mutably borrows from an owned value. Read more