pub struct RoomPowerLevelsEvent<E>where
E: Event,{ /* private fields */ }
state-res
only.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> RoomPowerLevelsEvent<E>where
E: Event,
impl<E> RoomPowerLevelsEvent<E>where
E: Event,
Sourcepub fn new(event: E) -> RoomPowerLevelsEvent<E>
pub fn new(event: E) -> RoomPowerLevelsEvent<E>
Construct a new RoomPowerLevelsEvent
around the given event.
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 for RoomPowerLevelsEvent<E>
impl<E> 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 more