pub struct RoomPowerLevelsEvent<E: Event> { /* private fields */ }Expand description
A helper type for an Event of type m.room.power_levels.
This is a type that deserializes each field lazily, when requested. Some deserialization results are cached in memory, if they are used often.
Implementations§
Source§impl<E: Event> RoomPowerLevelsEvent<E>
impl<E: Event> RoomPowerLevelsEvent<E>
Sourcepub fn get_as_int(
&self,
field: RoomPowerLevelsIntField,
rules: &AuthorizationRules,
) -> Result<Option<Int>, String>
pub fn get_as_int( &self, field: RoomPowerLevelsIntField, rules: &AuthorizationRules, ) -> Result<Option<Int>, String>
Get the value of a field that should contain an integer, if any.
The deserialization of this field is cached in memory.
Sourcepub fn get_as_int_or_default(
&self,
field: RoomPowerLevelsIntField,
rules: &AuthorizationRules,
) -> Result<Int, String>
pub fn get_as_int_or_default( &self, field: RoomPowerLevelsIntField, rules: &AuthorizationRules, ) -> Result<Int, String>
Get the value of a field that should contain an integer, or its default value if it is absent.
Sourcepub fn events(
&self,
rules: &AuthorizationRules,
) -> Result<Option<BTreeMap<TimelineEventType, Int>>, String>
pub fn events( &self, rules: &AuthorizationRules, ) -> Result<Option<BTreeMap<TimelineEventType, Int>>, String>
Get the power levels required to send events, if any.
Sourcepub fn notifications(
&self,
rules: &AuthorizationRules,
) -> Result<Option<BTreeMap<String, Int>>, String>
pub fn notifications( &self, rules: &AuthorizationRules, ) -> Result<Option<BTreeMap<String, Int>>, String>
Get the power levels required to trigger notifications, if any.
Sourcepub fn users(
&self,
rules: &AuthorizationRules,
) -> Result<Option<&BTreeMap<OwnedUserId, Int>>, String>
pub fn users( &self, rules: &AuthorizationRules, ) -> Result<Option<&BTreeMap<OwnedUserId, Int>>, String>
Get the power levels of the users, if any.
The deserialization of this field is cached in memory.
Sourcepub fn user_power_level(
&self,
user_id: &UserId,
rules: &AuthorizationRules,
) -> Result<Int, String>
pub fn user_power_level( &self, user_id: &UserId, rules: &AuthorizationRules, ) -> Result<Int, String>
Get the power level of the user with the given ID.
Calling this method several times should be cheap because the necessary deserialization results are cached.
Sourcepub fn event_power_level(
&self,
event_type: &TimelineEventType,
state_key: Option<&str>,
rules: &AuthorizationRules,
) -> Result<Int, String>
pub fn event_power_level( &self, event_type: &TimelineEventType, state_key: Option<&str>, rules: &AuthorizationRules, ) -> Result<Int, String>
Get the power level required to send an event of the given type.
Trait Implementations§
Source§impl<E: Clone + Event> Clone for RoomPowerLevelsEvent<E>
impl<E: Clone + Event> Clone for RoomPowerLevelsEvent<E>
Source§fn clone(&self) -> RoomPowerLevelsEvent<E>
fn clone(&self) -> RoomPowerLevelsEvent<E>
1.0.0 · Source§fn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
source. Read moreAuto Trait Implementations§
impl<E> Freeze for RoomPowerLevelsEvent<E>
impl<E> RefUnwindSafe for RoomPowerLevelsEvent<E>where
E: RefUnwindSafe,
impl<E> Send for RoomPowerLevelsEvent<E>
impl<E> Sync for RoomPowerLevelsEvent<E>
impl<E> Unpin for RoomPowerLevelsEvent<E>
impl<E> UnwindSafe for RoomPowerLevelsEvent<E>where
E: RefUnwindSafe,
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
Source§impl<T> CloneToUninit for Twhere
T: Clone,
impl<T> CloneToUninit for Twhere
T: Clone,
§impl<T, UT> HandleAlloc<UT> for T
impl<T, UT> HandleAlloc<UT> for T
§fn new_handle(value: Arc<T>) -> Handle
fn new_handle(value: Arc<T>) -> Handle
§unsafe fn clone_handle(handle: Handle) -> Handle
unsafe fn clone_handle(handle: Handle) -> Handle
§unsafe fn consume_handle(handle: Handle) -> Arc<T>
unsafe fn consume_handle(handle: Handle) -> Arc<T>
Arc<> Read more