#[non_exhaustive]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 (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>
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
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
Returns a duplicate 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<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>,
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) -> PatternedPushRule
fn from(new_rule: NewPatternedPushRule) -> PatternedPushRule
Converts to this type from the input type.
Source§impl From<PatternedPushRule> for PushRule
impl From<PatternedPushRule> for PushRule
Source§fn from(push_rule: PatternedPushRule) -> PushRule
fn from(push_rule: PatternedPushRule) -> PushRule
Converts to this type from the input type.
Source§impl From<PatternedPushRuleInit> for PatternedPushRule
impl From<PatternedPushRuleInit> for PatternedPushRule
Source§fn from(init: PatternedPushRuleInit) -> PatternedPushRule
fn from(init: PatternedPushRuleInit) -> PatternedPushRule
Converts to this type from the input type.
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,
Serialize this value into the given Serde serializer. Read more
Source§impl TryFrom<PushRule> for PatternedPushRule
impl TryFrom<PushRule> for PatternedPushRule
Source§type Error = MissingPatternError
type Error = MissingPatternError
The type returned in the event of a conversion error.
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>
Performs the conversion.
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
Mutably borrows from an owned value. Read more
Source§impl<T> CloneToUninit for Twhere
T: Clone,
impl<T> CloneToUninit for Twhere
T: Clone,
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
Compare self to
key
and return true
if they are equal.