Skip to main content

Notifications

Trait Notifications 

Source
pub trait Notifications {
    // Required methods
    fn post(&self, notification: &Notification) -> PostFuture;
    fn remove(&self, id: &str);
    fn permission(&self) -> Option<&dyn NotificationPermission>;
    fn replies(&self) -> Option<&dyn NotificationReplies>;
    fn scheduling(&self) -> Option<&dyn NotificationScheduling>;
}
Expand description

The system’s notifications.

Required Methods§

Source

fn post(&self, notification: &Notification) -> PostFuture

Shows notification, in place of the one posted under its id while that is still there. It never asks the user and never reads the permission first: it answers NotificationError::Denied where the system refuses the post itself, and otherwise the system decides whether it shows. Whether the app may notify, and asking, is Notifications::permission’s.

Source

fn remove(&self, id: &str)

Takes away the notification posted or scheduled under id.

Source

fn permission(&self) -> Option<&dyn NotificationPermission>

The user’s permission, where the system keeps one for the app; None where any app may notify.

Source

fn replies(&self) -> Option<&dyn NotificationReplies>

A typed reply, where the system takes one.

Source

fn scheduling(&self) -> Option<&dyn NotificationScheduling>

Delivery at a later time, held by the system whether or not the app runs.

Dyn Compatibility§

This trait is dyn compatible.

In older versions of Rust, dyn compatibility was called "object safety".

Implementors§