Struct ruma::push::Ruleset[][src]

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

impl Ruleset[src]

pub fn server_default(user_id: &UserId) -> Ruleset[src]

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

impl Ruleset[src]

pub fn new() -> Ruleset[src]

Creates an empty Ruleset.

pub fn iter(&self) -> RulesetIter<'_>

Notable traits for RulesetIter<'a>

impl<'a> Iterator for RulesetIter<'a> type Item = AnyPushRuleRef<'a>;
[src]

Creates a borrowing iterator over all push rules in this Ruleset.

For an owning iterator, use .into_iter().

pub fn add(&mut self, rule: AnyPushRule) -> bool[src]

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
[src]

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.

pub fn get_actions<T>(
    &self,
    event: &Raw<T>,
    context: &PushConditionRoomCtx
) -> &[Action]

Notable traits for &'_ [u8]

impl<'_> Read for &'_ [u8]impl<'_> Write for &'_ mut [u8]
where
    T: Serialize
[src]

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

impl Clone for Ruleset[src]

pub fn clone(&self) -> Ruleset[src]

Returns a copy of the value. Read more

fn clone_from(&mut self, source: &Self)1.0.0[src]

Performs copy-assignment from source. Read more

impl Debug for Ruleset[src]

pub fn fmt(&self, f: &mut Formatter<'_>) -> Result<(), Error>[src]

Formats the value using the given formatter. Read more

impl Default for Ruleset[src]

pub fn default() -> Ruleset[src]

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

impl<'de> Deserialize<'de> for Ruleset[src]

pub fn deserialize<__D>(
    __deserializer: __D
) -> Result<Ruleset, <__D as Deserializer<'de>>::Error> where
    __D: Deserializer<'de>, 
[src]

Deserialize this value from the given Serde deserializer. Read more

impl Extend<AnyPushRule> for Ruleset[src]

pub fn extend<T>(&mut self, iter: T) where
    T: IntoIterator<Item = AnyPushRule>, 
[src]

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

fn extend_one(&mut self, item: A)[src]

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

Extends a collection with exactly one element.

fn extend_reserve(&mut self, additional: usize)[src]

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

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

impl From<Ruleset> for PushRulesEventContent[src]

pub fn from(global: Ruleset) -> PushRulesEventContent[src]

Performs the conversion.

impl<'a> IntoIterator for &'a Ruleset[src]

type Item = AnyPushRuleRef<'a>

The type of the elements being iterated over.

type IntoIter = RulesetIter<'a>

Which kind of iterator are we turning this into?

pub fn into_iter(self) -> <&'a Ruleset as IntoIterator>::IntoIter[src]

Creates an iterator from a value. Read more

impl IntoIterator for Ruleset[src]

type Item = AnyPushRule

The type of the elements being iterated over.

type IntoIter = RulesetIntoIter

Which kind of iterator are we turning this into?

pub fn into_iter(self) -> <Ruleset as IntoIterator>::IntoIter[src]

Creates an iterator from a value. Read more

impl Serialize for Ruleset[src]

pub fn serialize<__S>(
    &self,
    __serializer: __S
) -> Result<<__S as Serializer>::Ok, <__S as Serializer>::Error> where
    __S: Serializer
[src]

Serialize this value into the given Serde serializer. Read more

Auto Trait Implementations

impl RefUnwindSafe for Ruleset

impl Send for Ruleset

impl Sync for Ruleset

impl Unpin for Ruleset

impl UnwindSafe for Ruleset

Blanket Implementations

impl<T> Any for T where
    T: 'static + ?Sized
[src]

pub fn type_id(&self) -> TypeId[src]

Gets the TypeId of self. Read more

impl<T> Borrow<T> for T where
    T: ?Sized
[src]

pub fn borrow(&self) -> &T[src]

Immutably borrows from an owned value. Read more

impl<T> BorrowMut<T> for T where
    T: ?Sized
[src]

pub fn borrow_mut(&mut self) -> &mut T[src]

Mutably borrows from an owned value. Read more

impl<T> From<T> for T[src]

pub fn from(t: T) -> T[src]

Performs the conversion.

impl<T> Instrument for T[src]

fn instrument(self, span: Span) -> Instrumented<Self>[src]

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

fn in_current_span(self) -> Instrumented<Self>[src]

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

impl<T> Instrument for T[src]

fn instrument(self, span: Span) -> Instrumented<Self>[src]

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

fn in_current_span(self) -> Instrumented<Self>[src]

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

impl<T, U> Into<U> for T where
    U: From<T>, 
[src]

pub fn into(self) -> U[src]

Performs the conversion.

impl<T> ToOwned for T where
    T: Clone
[src]

type Owned = T

The resulting type after obtaining ownership.

pub fn to_owned(&self) -> T[src]

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

pub fn clone_into(&self, target: &mut T)[src]

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

recently added

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

impl<T, U> TryFrom<U> for T where
    U: Into<T>, 
[src]

type Error = Infallible

The type returned in the event of a conversion error.

pub fn try_from(value: U) -> Result<T, <T as TryFrom<U>>::Error>[src]

Performs the conversion.

impl<T, U> TryInto<U> for T where
    U: TryFrom<T>, 
[src]

type Error = <U as TryFrom<T>>::Error

The type returned in the event of a conversion error.

pub fn try_into(self) -> Result<U, <U as TryFrom<T>>::Error>[src]

Performs the conversion.

impl<V, T> VZip<V> for T where
    V: MultiLane<T>, 

pub fn vzip(self) -> V

impl<T> WithSubscriber for T[src]

fn with_subscriber<S>(self, subscriber: S) -> WithDispatch<Self> where
    S: Into<Dispatch>, 
[src]

Attaches the provided Subscriber to this type, returning a WithDispatch wrapper. Read more

fn with_current_subscriber(self) -> WithDispatch<Self>[src]

Attaches the current default Subscriber to this type, returning a WithDispatch wrapper. Read more

impl<T> DeserializeOwned for T where
    T: for<'de> Deserialize<'de>, 
[src]