Struct ruma_common::push::PatternedPushRule
source · pub struct PatternedPushRule {
pub actions: Vec<Action>,
pub default: bool,
pub enabled: bool,
pub rule_id: String,
pub pattern: String,
}Expand description
Like SimplePushRule, but with an additional pattern field.
Only applicable to content rules.
To create an instance of this type, first create a PatternedPushRuleInit and convert it via
PatternedPushRule::from / .into().
Fields§
§actions: Vec<Action>Actions to determine if and how a notification is delivered for events matching this rule.
default: boolWhether this is a default rule, or has been set explicitly.
enabled: boolWhether the push rule is enabled or not.
rule_id: StringThe ID of this rule.
pattern: StringThe glob-style pattern to match against.
Implementations§
source§impl PatternedPushRule
impl PatternedPushRule
Default content push rules
sourcepub fn contains_user_name(user_id: &UserId) -> Self
pub fn contains_user_name(user_id: &UserId) -> Self
Matches any message whose content is unencrypted and contains the local part of the user’s Matrix ID, separated by word boundaries.
source§impl PatternedPushRule
impl PatternedPushRule
sourcepub fn applies_to(
&self,
key: &str,
event: &FlattenedJson,
context: &PushConditionRoomCtx
) -> bool
pub fn applies_to(
&self,
key: &str,
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§
source§impl Clone for PatternedPushRule
impl Clone for PatternedPushRule
source§fn clone(&self) -> PatternedPushRule
fn clone(&self) -> PatternedPushRule
Returns a copy of the value. Read more
1.0.0 · source§fn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
Performs copy-assignment from
source. Read moresource§impl Debug for PatternedPushRule
impl Debug for PatternedPushRule
source§impl<'de> Deserialize<'de> for PatternedPushRule
impl<'de> Deserialize<'de> for PatternedPushRule
source§fn 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
source§impl Equivalent<PatternedPushRule> for str
impl Equivalent<PatternedPushRule> for str
source§fn equivalent(&self, key: &PatternedPushRule) -> bool
fn equivalent(&self, key: &PatternedPushRule) -> bool
Compare self to
key and return true if they are equal.source§impl From<NewPatternedPushRule> for PatternedPushRule
impl From<NewPatternedPushRule> for PatternedPushRule
source§fn from(new_rule: NewPatternedPushRule) -> Self
fn from(new_rule: NewPatternedPushRule) -> Self
Converts to this type from the input type.
source§impl From<PatternedPushRuleInit> for PatternedPushRule
impl From<PatternedPushRuleInit> for PatternedPushRule
source§fn from(init: PatternedPushRuleInit) -> Self
fn from(init: PatternedPushRuleInit) -> Self
Converts to this type from the input type.
source§impl Hash for PatternedPushRule
impl Hash for PatternedPushRule
source§impl PartialEq<PatternedPushRule> for PatternedPushRule
impl PartialEq<PatternedPushRule> for PatternedPushRule
source§impl Serialize for PatternedPushRule
impl Serialize for PatternedPushRule
impl Eq for PatternedPushRule
Auto Trait Implementations§
impl RefUnwindSafe for PatternedPushRule
impl Send for PatternedPushRule
impl Sync for PatternedPushRule
impl Unpin for PatternedPushRule
impl UnwindSafe for PatternedPushRule
Blanket Implementations§
source§impl<Q, K> Equivalent<K> for Qwhere
Q: Eq + ?Sized,
K: Borrow<Q> + ?Sized,
impl<Q, K> Equivalent<K> for Qwhere
Q: Eq + ?Sized,
K: Borrow<Q> + ?Sized,
source§fn equivalent(&self, key: &K) -> bool
fn equivalent(&self, key: &K) -> bool
Compare self to
key and return true if they are equal.