Struct ruma::push::Ruleset [−][src]
pub struct Ruleset {
pub content: IndexSet<PatternedPushRule, RandomState>,
pub override_: IndexSet<ConditionalPushRule, RandomState>,
pub room: IndexSet<SimplePushRule, RandomState>,
pub sender: IndexSet<SimplePushRule, RandomState>,
pub underride: IndexSet<ConditionalPushRule, RandomState>,
}
Expand description
A push ruleset scopes a set of rules according to some criteria.
For example, some rules may only be applied for messages from a particular sender, a particular room, or by default. The push ruleset contains the entire set of scopes and rules.
Fields
content: IndexSet<PatternedPushRule, RandomState>
These rules configure behavior for (unencrypted) messages that match certain patterns.
override_: IndexSet<ConditionalPushRule, RandomState>
These user-configured rules are given the highest priority.
This field is named override_
instead of override
because the latter is a reserved
keyword in Rust.
room: IndexSet<SimplePushRule, RandomState>
These rules change the behavior of all messages for a given room.
sender: IndexSet<SimplePushRule, RandomState>
These rules configure notification behavior for messages from a specific Matrix user ID.
underride: IndexSet<ConditionalPushRule, RandomState>
These rules are identical to override rules, but have a lower priority than content
,
room
and sender
rules.
Implementations
The list of all predefined push rules.
Parameters
user_id
: the user for which to generate the default rules. Some rules depend on the user’s ID (for instance those to send notifications when they are mentioned).
pub fn iter(&self) -> RulesetIter<'_>ⓘNotable traits for RulesetIter<'a>impl<'a> Iterator for RulesetIter<'a> type Item = AnyPushRuleRef<'a>;
pub fn iter(&self) -> RulesetIter<'_>ⓘNotable traits for RulesetIter<'a>impl<'a> Iterator for RulesetIter<'a> type Item = AnyPushRuleRef<'a>;
impl<'a> Iterator for RulesetIter<'a> type Item = AnyPushRuleRef<'a>;
Creates a borrowing iterator over all push rules in this Ruleset
.
For an owning iterator, use .into_iter()
.
Adds a rule to the rule set.
Returns true
if the new rule was correctly added, and false
if a rule with the same rule_id
is already present for this kind
of rule.
pub fn get_match<T>(
&self,
event: &Raw<T>,
context: &PushConditionRoomCtx
) -> Option<AnyPushRuleRef<'_>> where
T: Serialize,
pub fn get_match<T>(
&self,
event: &Raw<T>,
context: &PushConditionRoomCtx
) -> Option<AnyPushRuleRef<'_>> where
T: Serialize,
Get the first push rule that applies to this event, if any.
Arguments
event
- The raw JSON of a room message event.context
- The context of the message and room at the time of the event.
Get the push actions that apply to this event.
Returns an empty slice if no push rule applies.
Arguments
event
- The raw JSON of a room message event.context
- The context of the message and room at the time of the event.
Trait Implementations
pub fn deserialize<__D>(
__deserializer: __D
) -> Result<Ruleset, <__D as Deserializer<'de>>::Error> where
__D: Deserializer<'de>,
pub fn deserialize<__D>(
__deserializer: __D
) -> Result<Ruleset, <__D as Deserializer<'de>>::Error> where
__D: Deserializer<'de>,
Deserialize this value from the given Serde deserializer. Read more
Extends a collection with the contents of an iterator. Read more
extend_one
)Extends a collection with exactly one element.
extend_one
)Reserves capacity in a collection for the given number of additional elements. Read more
Performs the conversion.
type Item = AnyPushRuleRef<'a>
type Item = AnyPushRuleRef<'a>
The type of the elements being iterated over.
type IntoIter = RulesetIter<'a>
type IntoIter = RulesetIter<'a>
Which kind of iterator are we turning this into?
type Item = AnyPushRule
type Item = AnyPushRule
The type of the elements being iterated over.
type IntoIter = RulesetIntoIter
type IntoIter = RulesetIntoIter
Which kind of iterator are we turning this into?
pub fn serialize<__S>(
&self,
__serializer: __S
) -> Result<<__S as Serializer>::Ok, <__S as Serializer>::Error> where
__S: Serializer,
pub fn serialize<__S>(
&self,
__serializer: __S
) -> Result<<__S as Serializer>::Ok, <__S as Serializer>::Error> where
__S: Serializer,
Serialize this value into the given Serde serializer. Read more
Auto Trait Implementations
impl RefUnwindSafe for Ruleset
impl UnwindSafe for Ruleset
Blanket Implementations
Mutably borrows from an owned value. Read more
Instruments this type with the provided Span
, returning an
Instrumented
wrapper. Read more
Instruments this type with the provided Span
, returning an
Instrumented
wrapper. Read more
type Output = T
type Output = T
Should always be Self
pub fn vzip(self) -> V
Attaches the provided Subscriber
to this type, returning a
WithDispatch
wrapper. Read more
Attaches the current default Subscriber
to this type, returning a
WithDispatch
wrapper. Read more