Struct ruma_common::push::ConditionalPushRule[][src]

#[non_exhaustive]
pub struct ConditionalPushRule { pub actions: Vec<Action>, pub default: bool, pub enabled: bool, pub rule_id: String, pub conditions: Vec<PushCondition>, }
Expand description

Like SimplePushRule, but with an additional conditions field.

Only applicable to underride and override rules.

To create an instance of this type, first create a ConditionalPushRuleInit and convert it via ConditionalPushRule::from / .into().

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.
actions: Vec<Action>
Expand description

Actions to determine if and how a notification is delivered for events matching this rule.

default: bool
Expand description

Whether this is a default rule, or has been set explicitly.

enabled: bool
Expand description

Whether the push rule is enabled or not.

rule_id: String
Expand description

The ID of this rule.

conditions: Vec<PushCondition>
Expand description

The conditions that must hold true for an event in order for a rule to be applied to an event.

A rule with no conditions always matches.

Implementations

impl ConditionalPushRule[src]

Default override push rules

pub fn master() -> Self[src]

Matches all events, this can be enabled to turn off all push notifications other than those generated by override rules set by the user.

pub fn suppress_notices() -> Self[src]

Matches messages with a msgtype of notice.

pub fn invite_for_me(user_id: &UserId) -> Self[src]

Matches any invites to a new room for this user.

pub fn member_event() -> Self[src]

Matches any m.room.member_event.

pub fn contains_display_name() -> Self[src]

Matches any message whose content is unencrypted and contains the user’s current display name in the room in which it was sent.

pub fn tombstone() -> Self[src]

Matches any state event whose type is m.room.tombstone. This is intended to notify users of a room when it is upgraded, similar to what an @room notification would accomplish.

pub fn roomnotif() -> Self[src]

Matches any message whose content is unencrypted and contains the text @room, signifying the whole room should be notified of the event.

impl ConditionalPushRule[src]

Default underrides push rules

pub fn call() -> Self[src]

Matches any incoming VOIP call.

pub fn encrypted_room_one_to_one() -> Self[src]

Matches any encrypted event sent in a room with exactly two members. Unlike other push rules, this rule cannot be matched against the content of the event by nature of it being encrypted. This causes the rule to be an “all or nothing” match where it either matches all events that are encrypted (in 1:1 rooms) or none.

pub fn room_one_to_one() -> Self[src]

Matches any message sent in a room with exactly two members.

pub fn message() -> Self[src]

Matches all chat messages.

pub fn encrypted() -> Self[src]

Matches all encrypted events. Unlike other push rules, this rule cannot be matched against the content of the event by nature of it being encrypted. This causes the rule to be an “all or nothing” match where it either matches all events that are encrypted (in group rooms) or none.

impl ConditionalPushRule[src]

pub fn applies(
    &self,
    event: &FlattenedJson,
    context: &PushConditionRoomCtx
) -> bool
[src]

Check if the push rule applies to the event.

Arguments

  • event - The flattened JSON representation of a room message event.
  • context - The context of the room at the time of the event.

Trait Implementations

impl Clone for ConditionalPushRule[src]

fn clone(&self) -> ConditionalPushRule[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 ConditionalPushRule[src]

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

Formats the value using the given formatter. Read more

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

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

Deserialize this value from the given Serde deserializer. Read more

impl From<ConditionalPushRuleInit> for ConditionalPushRule[src]

fn from(init: ConditionalPushRuleInit) -> Self[src]

Performs the conversion.

impl Hash for ConditionalPushRule[src]

fn hash<H: Hasher>(&self, state: &mut H)[src]

Feeds this value into the given Hasher. Read more

fn hash_slice<H>(data: &[Self], state: &mut H) where
    H: Hasher
1.3.0[src]

Feeds a slice of this type into the given Hasher. Read more

impl PartialEq<ConditionalPushRule> for ConditionalPushRule[src]

fn eq(&self, other: &Self) -> bool[src]

This method tests for self and other values to be equal, and is used by ==. Read more

#[must_use]
fn ne(&self, other: &Rhs) -> bool
1.0.0[src]

This method tests for !=.

impl Serialize for ConditionalPushRule[src]

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

Serialize this value into the given Serde serializer. Read more

impl Eq for ConditionalPushRule[src]

Auto Trait Implementations

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<Q, K> Equivalent<K> for Q where
    K: Borrow<Q> + ?Sized,
    Q: Eq + ?Sized
[src]

pub fn equivalent(&self, key: &K) -> bool[src]

Compare self to key and return true if they are equal.

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, 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<T> DeserializeOwned for T where
    T: for<'de> Deserialize<'de>, 
[src]