#[non_exhaustive]pub enum PushCondition {
EventMatch(EventMatchConditionData),
ContainsDisplayName,
RoomMemberCount(RoomMemberCountConditionData),
SenderNotificationPermission(SenderNotificationPermissionConditionData),
RoomVersionSupports(RoomVersionSupportsConditionData),
EventPropertyIs(EventPropertyIsConditionData),
EventPropertyContains(EventPropertyContainsConditionData),
ThreadSubscription(ThreadSubscriptionConditionData),
}Expand description
A condition that must apply for an associated push rule’s action to be taken.
Variants (Non-exhaustive)§
This enum is marked as non-exhaustive
EventMatch(EventMatchConditionData)
A glob pattern match on a field of the event.
ContainsDisplayName
Matches unencrypted messages where content.body contains the owner’s display name in that
room.
RoomMemberCount(RoomMemberCountConditionData)
Matches the current number of members in the room.
SenderNotificationPermission(SenderNotificationPermissionConditionData)
Takes into account the current power levels in the room, ensuring the sender of the event has high enough power to trigger the notification.
RoomVersionSupports(RoomVersionSupportsConditionData)
unstable-msc3931 only.Apply the rule only to rooms that support a given feature.
EventPropertyIs(EventPropertyIsConditionData)
Exact value match on a property of the event.
EventPropertyContains(EventPropertyContainsConditionData)
Exact value match on a value in an array property of the event.
ThreadSubscription(ThreadSubscriptionConditionData)
unstable-msc4306 only.Matches a thread event based on the user’s thread subscription status, as defined by MSC4306.
Implementations§
Source§impl PushCondition
impl PushCondition
Sourcepub fn kind(&self) -> &str
Available on crate feature events only.
pub fn kind(&self) -> &str
events only.The value of the kind field for this condition.
Sourcepub fn custom_data(&self) -> Option<&Map<String, Value>>
Available on crate feature events only.
pub fn custom_data(&self) -> Option<&Map<String, Value>>
events only.The data, if this is a custom condition.
Sourcepub async fn applies(
&self,
event: &FlattenedJson,
context: &PushConditionRoomCtx,
) -> bool
Available on crate feature events only.
pub async 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.
Returns false if this condition is unsupported.
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<EventMatchConditionData> for PushCondition
impl From<EventMatchConditionData> for PushCondition
Source§fn from(value: EventMatchConditionData) -> PushCondition
fn from(value: EventMatchConditionData) -> PushCondition
Source§impl From<EventPropertyContainsConditionData> for PushCondition
impl From<EventPropertyContainsConditionData> for PushCondition
Source§fn from(value: EventPropertyContainsConditionData) -> PushCondition
fn from(value: EventPropertyContainsConditionData) -> PushCondition
Source§impl From<EventPropertyIsConditionData> for PushCondition
impl From<EventPropertyIsConditionData> for PushCondition
Source§fn from(value: EventPropertyIsConditionData) -> PushCondition
fn from(value: EventPropertyIsConditionData) -> PushCondition
Source§impl From<RoomMemberCountConditionData> for PushCondition
impl From<RoomMemberCountConditionData> for PushCondition
Source§fn from(value: RoomMemberCountConditionData) -> PushCondition
fn from(value: RoomMemberCountConditionData) -> PushCondition
Source§impl From<RoomVersionSupportsConditionData> for PushCondition
Available on crate feature unstable-msc3931 only.
impl From<RoomVersionSupportsConditionData> for PushCondition
unstable-msc3931 only.Source§fn from(value: RoomVersionSupportsConditionData) -> PushCondition
fn from(value: RoomVersionSupportsConditionData) -> PushCondition
Source§impl From<SenderNotificationPermissionConditionData> for PushCondition
impl From<SenderNotificationPermissionConditionData> for PushCondition
Source§fn from(value: SenderNotificationPermissionConditionData) -> PushCondition
fn from(value: SenderNotificationPermissionConditionData) -> PushCondition
Source§impl From<ThreadSubscriptionConditionData> for PushCondition
Available on crate feature unstable-msc4306 only.
impl From<ThreadSubscriptionConditionData> for PushCondition
unstable-msc4306 only.Source§fn from(value: ThreadSubscriptionConditionData) -> PushCondition
fn from(value: ThreadSubscriptionConditionData) -> 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 UnsafeUnpin 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§impl<T> DropFlavorWrapper<T> for T
impl<T> DropFlavorWrapper<T> for T
§impl<T, UT> HandleAlloc<UT> for T
impl<T, UT> HandleAlloc<UT> for T
§fn new_handle(value: Arc<T>) -> Handle
fn new_handle(value: Arc<T>) -> Handle
§unsafe fn clone_handle(handle: Handle) -> Handle
unsafe fn clone_handle(handle: Handle) -> Handle
§unsafe fn consume_handle(handle: Handle) -> Arc<T>
unsafe fn consume_handle(handle: Handle) -> Arc<T>
Arc<> Read more