Enum ruma::push::PushCondition
source · pub enum PushCondition {
EventMatch {
key: String,
pattern: String,
},
ContainsDisplayName,
RoomMemberCount {
is: RoomMemberCountIs,
},
SenderNotificationPermission {
key: String,
},
RoomVersionSupports {
feature: RoomVersionFeature,
},
EventPropertyIs {
key: String,
value: ScalarJsonValue,
},
EventPropertyContains {
key: String,
value: ScalarJsonValue,
},
// some variants omitted
}
Expand description
A condition that must apply for an associated push rule’s action to be taken.
Variants§
EventMatch
A glob pattern match on a field of the event.
Fields
key: String
The dot-separated path of the property of the event to match.
ContainsDisplayName
Matches unencrypted messages where content.body
contains the owner’s display name in that
room.
RoomMemberCount
Matches the current number of members in the room.
Fields
is: RoomMemberCountIs
The condition on the current number of members in the room.
SenderNotificationPermission
Takes into account the current power levels in the room, ensuring the sender of the event has high enough power to trigger the notification.
Fields
RoomVersionSupports
unstable-msc3931
only.Apply the rule only to rooms that support a given feature.
Fields
feature: RoomVersionFeature
The feature the room must support for the push rule to apply.
EventPropertyIs
Exact value match on a property of the event.
Fields
key: String
The dot-separated path of the property of the event to match.
value: ScalarJsonValue
The value to match against.
EventPropertyContains
Exact value match on a value in an array property of the event.
Fields
key: String
The dot-separated path of the property of the event to match.
value: ScalarJsonValue
The value to match against.
Implementations§
source§impl PushCondition
impl PushCondition
sourcepub fn applies(
&self,
event: &FlattenedJson,
context: &PushConditionRoomCtx,
) -> bool
Available on crate feature events
only.
pub fn applies( &self, event: &FlattenedJson, context: &PushConditionRoomCtx, ) -> bool
events
only.Check if this condition 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. If the power levels context is missing from it, conditions that depend on it will never apply.
Trait Implementations§
source§impl Clone for PushCondition
impl Clone for PushCondition
source§fn clone(&self) -> PushCondition
fn clone(&self) -> PushCondition
1.0.0 · source§fn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
source
. Read moresource§impl Debug for PushCondition
impl Debug for PushCondition
source§impl<'de> Deserialize<'de> for PushCondition
impl<'de> Deserialize<'de> for PushCondition
source§fn deserialize<D>(
deserializer: D,
) -> Result<PushCondition, <D as Deserializer<'de>>::Error>where
D: Deserializer<'de>,
fn deserialize<D>(
deserializer: D,
) -> Result<PushCondition, <D as Deserializer<'de>>::Error>where
D: Deserializer<'de>,
source§impl From<PushConditionSerDeHelper> for PushCondition
impl From<PushConditionSerDeHelper> for PushCondition
source§fn from(value: PushConditionSerDeHelper) -> PushCondition
fn from(value: PushConditionSerDeHelper) -> PushCondition
source§impl Serialize for PushCondition
impl Serialize for PushCondition
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,
Auto Trait Implementations§
impl Freeze for PushCondition
impl RefUnwindSafe for PushCondition
impl Send for PushCondition
impl Sync for PushCondition
impl Unpin for PushCondition
impl UnwindSafe for PushCondition
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<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