logo
#[non_exhaustive]
pub struct Ruleset { pub content: IndexSet<PatternedPushRule>, pub override_: IndexSet<ConditionalPushRule>, pub room: IndexSet<SimplePushRule>, pub sender: IndexSet<SimplePushRule>, pub underride: IndexSet<ConditionalPushRule>, }
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 (Non-exhaustive)

This struct is marked as non-exhaustive
Non-exhaustive structs could have additional fields added in future. Therefore, non-exhaustive structs cannot be constructed in external crates using the traditional Struct { .. } syntax; cannot be matched against without a wildcard ..; and struct update syntax will not work.
content: IndexSet<PatternedPushRule>

These rules configure behavior for (unencrypted) messages that match certain patterns.

override_: IndexSet<ConditionalPushRule>

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>

These rules change the behavior of all messages for a given room.

sender: IndexSet<SimplePushRule>

These rules configure notification behavior for messages from a specific Matrix user ID.

underride: IndexSet<ConditionalPushRule>

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).

Creates an empty Ruleset.

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.

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

Returns a copy of the value. Read more

Performs copy-assignment from source. Read more

Formats the value using the given formatter. Read more

Returns the “default value” for a type. Read more

Deserialize this value from the given Serde deserializer. Read more

Extends a collection with the contents of an iterator. Read more

🔬 This is a nightly-only experimental API. (extend_one)

Extends a collection with exactly one element.

🔬 This is a nightly-only experimental API. (extend_one)

Reserves capacity in a collection for the given number of additional elements. Read more

Converts to this type from the input type.

The type of the elements being iterated over.

Which kind of iterator are we turning this into?

Creates an iterator from a value. Read more

The type of the elements being iterated over.

Which kind of iterator are we turning this into?

Creates an iterator from a value. Read more

Serialize this value into the given Serde serializer. Read more

Auto Trait Implementations

Blanket Implementations

Gets the TypeId of self. Read more

Immutably borrows from an owned value. Read more

Mutably borrows from an owned value. Read more

Returns the argument unchanged.

Instruments this type with the provided Span, returning an Instrumented wrapper. Read more

Instruments this type with the current Span, returning an Instrumented wrapper. Read more

Calls U::from(self).

That is, this conversion is whatever the implementation of From<T> for U chooses to do.

The resulting type after obtaining ownership.

Creates owned data from borrowed data, usually by cloning. Read more

Uses borrowed data to replace owned data, usually by cloning. Read more

The type returned in the event of a conversion error.

Performs the conversion.

The type returned in the event of a conversion error.

Performs the conversion.

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