Struct ruma_common::push::ConditionalPushRule
source · [−]#[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
Struct { .. }
syntax; cannot be matched against without a wildcard ..
; and struct update syntax will not work.actions: Vec<Action>
Actions to determine if and how a notification is delivered for events matching this rule.
default: bool
Whether this is a default rule, or has been set explicitly.
enabled: bool
Whether the push rule is enabled or not.
rule_id: String
The ID of this rule.
conditions: Vec<PushCondition>
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
sourceimpl ConditionalPushRule
impl ConditionalPushRule
Default override push rules
sourcepub fn master() -> Self
pub fn master() -> Self
Matches all events, this can be enabled to turn off all push notifications other than those generated by override rules set by the user.
sourcepub fn suppress_notices() -> Self
pub fn suppress_notices() -> Self
Matches messages with a msgtype
of notice
.
sourcepub fn invite_for_me(user_id: &UserId) -> Self
pub fn invite_for_me(user_id: &UserId) -> Self
Matches any invites to a new room for this user.
sourcepub fn member_event() -> Self
pub fn member_event() -> Self
Matches any m.room.member_event
.
sourcepub fn contains_display_name() -> Self
pub fn contains_display_name() -> Self
Matches any message whose content is unencrypted and contains the user’s current display name in the room in which it was sent.
sourcepub fn tombstone() -> Self
pub fn tombstone() -> Self
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.
sourceimpl ConditionalPushRule
impl ConditionalPushRule
Default underrides push rules
sourcepub fn encrypted_room_one_to_one() -> Self
pub fn encrypted_room_one_to_one() -> Self
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.
sourcepub fn room_one_to_one() -> Self
pub fn room_one_to_one() -> Self
Matches any message sent in a room with exactly two members.
sourcepub fn encrypted() -> Self
pub fn encrypted() -> Self
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.
sourceimpl ConditionalPushRule
impl ConditionalPushRule
sourcepub fn applies(
&self,
event: &FlattenedJson,
context: &PushConditionRoomCtx
) -> bool
pub fn applies(
&self,
event: &FlattenedJson,
context: &PushConditionRoomCtx
) -> bool
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
sourceimpl Clone for ConditionalPushRule
impl Clone for ConditionalPushRule
sourcefn clone(&self) -> ConditionalPushRule
fn clone(&self) -> ConditionalPushRule
Returns a copy of the value. Read more
1.0.0 · sourcefn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
Performs copy-assignment from source
. Read more
sourceimpl Debug for ConditionalPushRule
impl Debug for ConditionalPushRule
sourceimpl<'de> Deserialize<'de> for ConditionalPushRule
impl<'de> Deserialize<'de> for ConditionalPushRule
sourcefn deserialize<__D>(__deserializer: __D) -> Result<Self, __D::Error> where
__D: Deserializer<'de>,
fn deserialize<__D>(__deserializer: __D) -> Result<Self, __D::Error> where
__D: Deserializer<'de>,
Deserialize this value from the given Serde deserializer. Read more
sourceimpl Equivalent<ConditionalPushRule> for str
impl Equivalent<ConditionalPushRule> for str
sourcefn equivalent(&self, key: &ConditionalPushRule) -> bool
fn equivalent(&self, key: &ConditionalPushRule) -> bool
Compare self to key
and return true
if they are equal.
sourceimpl From<ConditionalPushRuleInit> for ConditionalPushRule
impl From<ConditionalPushRuleInit> for ConditionalPushRule
sourcefn from(init: ConditionalPushRuleInit) -> Self
fn from(init: ConditionalPushRuleInit) -> Self
Converts to this type from the input type.
sourceimpl Hash for ConditionalPushRule
impl Hash for ConditionalPushRule
sourceimpl Serialize for ConditionalPushRule
impl Serialize for ConditionalPushRule
impl Eq for ConditionalPushRule
Auto Trait Implementations
impl RefUnwindSafe for ConditionalPushRule
impl Send for ConditionalPushRule
impl Sync for ConditionalPushRule
impl Unpin for ConditionalPushRule
impl UnwindSafe for ConditionalPushRule
Blanket Implementations
sourceimpl<T> BorrowMut<T> for T where
T: ?Sized,
impl<T> BorrowMut<T> for T where
T: ?Sized,
const: unstable · sourcefn borrow_mut(&mut self) -> &mut T
fn borrow_mut(&mut self) -> &mut T
Mutably borrows from an owned value. Read more
sourceimpl<T> CallHasher for T where
T: Hash + ?Sized,
impl<T> CallHasher for T where
T: Hash + ?Sized,
sourceimpl<Q, K> Equivalent<K> for Q where
Q: Eq + ?Sized,
K: Borrow<Q> + ?Sized,
impl<Q, K> Equivalent<K> for Q where
Q: Eq + ?Sized,
K: Borrow<Q> + ?Sized,
sourcefn equivalent(&self, key: &K) -> bool
fn equivalent(&self, key: &K) -> bool
Compare self to key
and return true
if they are equal.
sourceimpl<T> Instrument for T
impl<T> Instrument for T
sourcefn instrument(self, span: Span) -> Instrumented<Self>
fn instrument(self, span: Span) -> Instrumented<Self>
sourcefn in_current_span(self) -> Instrumented<Self>
fn in_current_span(self) -> Instrumented<Self>
sourceimpl<T> WithSubscriber for T
impl<T> WithSubscriber for T
sourcefn with_subscriber<S>(self, subscriber: S) -> WithDispatch<Self> where
S: Into<Dispatch>,
fn with_subscriber<S>(self, subscriber: S) -> WithDispatch<Self> where
S: Into<Dispatch>,
Attaches the provided Subscriber
to this type, returning a
WithDispatch
wrapper. Read more
sourcefn with_current_subscriber(self) -> WithDispatch<Self>
fn with_current_subscriber(self) -> WithDispatch<Self>
Attaches the current default Subscriber
to this type, returning a
WithDispatch
wrapper. Read more