Struct ruma::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: 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.
pattern: String
The glob-style pattern to match against.
Implementations§
source§impl PatternedPushRule
impl PatternedPushRule
Default content push rules
sourcepub fn contains_user_name(user_id: &UserId) -> PatternedPushRule
👎Deprecated: Since Matrix 1.7. Use the m.mentions property with ConditionalPushRule::is_user_mention() instead.Available on crate feature events
only.
pub fn contains_user_name(user_id: &UserId) -> PatternedPushRule
events
only.Matches any message whose content is unencrypted and contains the local part of the user’s Matrix ID, separated by word boundaries.
Since Matrix 1.7, this rule only matches if the event’s content does not contain an
m.mentions
property.
source§impl PatternedPushRule
impl PatternedPushRule
sourcepub fn applies_to(
&self,
key: &str,
event: &FlattenedJson,
context: &PushConditionRoomCtx,
) -> bool
Available on crate feature events
only.
pub fn applies_to( &self, key: &str, event: &FlattenedJson, context: &PushConditionRoomCtx, ) -> bool
events
only.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
1.0.0 · source§fn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
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<PatternedPushRule, <__D as Deserializer<'de>>::Error>where
__D: Deserializer<'de>,
fn deserialize<__D>(
__deserializer: __D,
) -> Result<PatternedPushRule, <__D as Deserializer<'de>>::Error>where
__D: Deserializer<'de>,
source§impl Equivalent<PatternedPushRule> for str
impl Equivalent<PatternedPushRule> for str
source§fn equivalent(&self, key: &PatternedPushRule) -> bool
fn equivalent(&self, key: &PatternedPushRule) -> bool
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) -> PatternedPushRule
fn from(new_rule: NewPatternedPushRule) -> PatternedPushRule
source§impl From<PatternedPushRule> for PushRule
impl From<PatternedPushRule> for PushRule
source§fn from(push_rule: PatternedPushRule) -> PushRule
fn from(push_rule: PatternedPushRule) -> PushRule
source§impl From<PatternedPushRuleInit> for PatternedPushRule
impl From<PatternedPushRuleInit> for PatternedPushRule
source§fn from(init: PatternedPushRuleInit) -> PatternedPushRule
fn from(init: PatternedPushRuleInit) -> PatternedPushRule
source§impl Hash for PatternedPushRule
impl Hash for PatternedPushRule
source§impl PartialEq for PatternedPushRule
impl PartialEq for PatternedPushRule
source§impl Serialize for PatternedPushRule
impl Serialize for PatternedPushRule
source§fn serialize<__S>(
&self,
__serializer: __S,
) -> Result<<__S as Serializer>::Ok, <__S as Serializer>::Error>where
__S: Serializer,
fn serialize<__S>(
&self,
__serializer: __S,
) -> Result<<__S as Serializer>::Ok, <__S as Serializer>::Error>where
__S: Serializer,
source§impl TryFrom<PushRule> for PatternedPushRule
impl TryFrom<PushRule> for PatternedPushRule
source§type Error = MissingPatternError
type Error = MissingPatternError
source§fn try_from(
push_rule: PushRule,
) -> Result<PatternedPushRule, <PatternedPushRule as TryFrom<PushRule>>::Error>
fn try_from( push_rule: PushRule, ) -> Result<PatternedPushRule, <PatternedPushRule as TryFrom<PushRule>>::Error>
impl Eq for PatternedPushRule
Auto Trait Implementations§
impl Freeze for PatternedPushRule
impl RefUnwindSafe for PatternedPushRule
impl Send for PatternedPushRule
impl Sync for PatternedPushRule
impl Unpin for PatternedPushRule
impl UnwindSafe for PatternedPushRule
Blanket Implementations§
source§impl<T> BorrowMut<T> for Twhere
T: ?Sized,
impl<T> BorrowMut<T> for Twhere
T: ?Sized,
source§fn borrow_mut(&mut self) -> &mut T
fn borrow_mut(&mut self) -> &mut T
source§impl<T> CloneToUninit for Twhere
T: Clone,
impl<T> CloneToUninit for Twhere
T: Clone,
source§unsafe fn clone_to_uninit(&self, dst: *mut T)
unsafe fn clone_to_uninit(&self, dst: *mut T)
clone_to_uninit
)source§impl<Q, K> Equivalent<K> for Q
impl<Q, K> Equivalent<K> for Q
source§impl<Q, K> Equivalent<K> for Q
impl<Q, K> Equivalent<K> for Q
source§fn equivalent(&self, key: &K) -> bool
fn equivalent(&self, key: &K) -> bool
key
and return true
if they are equal.source§impl<T, W> HasTypeWitness<W> for Twhere
W: MakeTypeWitness<Arg = T>,
T: ?Sized,
impl<T, W> HasTypeWitness<W> for Twhere
W: MakeTypeWitness<Arg = T>,
T: ?Sized,
source§impl<T> Identity for Twhere
T: ?Sized,
impl<T> Identity for Twhere
T: ?Sized,
source§impl<T> Instrument for T
impl<T> Instrument for T
source§fn instrument(self, span: Span) -> Instrumented<Self>
fn instrument(self, span: Span) -> Instrumented<Self>
source§fn in_current_span(self) -> Instrumented<Self>
fn in_current_span(self) -> Instrumented<Self>
source§impl<T> IntoEither for T
impl<T> IntoEither for T
source§fn into_either(self, into_left: bool) -> Either<Self, Self>
fn into_either(self, into_left: bool) -> Either<Self, Self>
self
into a Left
variant of Either<Self, Self>
if into_left
is true
.
Converts self
into a Right
variant of Either<Self, Self>
otherwise. Read moresource§fn into_either_with<F>(self, into_left: F) -> Either<Self, Self>
fn into_either_with<F>(self, into_left: F) -> Either<Self, Self>
self
into a Left
variant of Either<Self, Self>
if into_left(&self)
returns true
.
Converts self
into a Right
variant of Either<Self, Self>
otherwise. Read more