#[non_exhaustive]pub enum Action {
Notify,
NotifyInApp,
SetTweak(Tweak),
}Expand description
This represents the different actions that should be taken when a rule is matched, and controls how notifications are delivered to the client.
See the spec for details.
Variants (Non-exhaustive)§
This enum is marked as non-exhaustive
Notify
Causes matching events to generate a notification (both in-app and remote / push).
NotifyInApp
unstable-msc3768 only.Causes matching events to generate an in-app notification but no remote / push notification.
SetTweak(Tweak)
Sets an entry in the ‘tweaks’ dictionary sent to the push gateway.
Implementations§
Source§impl Action
impl Action
Sourcepub fn new(data: CustomActionData) -> Result<Self>
pub fn new(data: CustomActionData) -> Result<Self>
Creates a new Action.
Prefer to use the public variants of Action where possible; this constructor is meant
be used for unsupported actions only and does not allow setting arbitrary data for
supported ones.
§Errors
Returns an error if the action type is known and deserialization of data to the
corresponding variant fails.
Sourcepub fn is_highlight(&self) -> bool
pub fn is_highlight(&self) -> bool
Whether this action is an Action::SetTweak(Tweak::Highlight(true)).
Sourcepub fn should_notify(&self) -> bool
pub fn should_notify(&self) -> bool
Whether this action should trigger a notification (either in-app or remote / push).
Sourcepub fn should_notify_remote(&self) -> bool
Available on crate feature unstable-msc3768 only.
pub fn should_notify_remote(&self) -> bool
unstable-msc3768 only.Whether this action should trigger a remote / push notification.
Sourcepub fn sound(&self) -> Option<&SoundTweakValue>
pub fn sound(&self) -> Option<&SoundTweakValue>
The sound that should be played with this action, if any.
Sourcepub fn custom_data(&self) -> Option<&CustomActionData>
pub fn custom_data(&self) -> Option<&CustomActionData>
Access the data if this is a custom action.