Skip to main content

Notifier

Trait Notifier 

pub trait Notifier: Send + Sync {
    // Required methods
    fn show(&self, notification: &Notification) -> Result<(), NotifyError>;
    fn withdraw(&self, tag: &str) -> Result<(), NotifyError>;

    // Provided methods
    fn schedule(
        &self,
        notification: &Notification,
        at: SystemTime,
    ) -> Result<(), NotifyError> { ... }
    fn schedule_alarm(
        &self,
        notification: &Notification,
        at: SystemTime,
        schedule: AlarmSchedule,
    ) -> Result<(), NotifyError> { ... }
    fn alarm_states(&self) -> Result<Vec<AlarmState>, NotifyError> { ... }
    fn scheduled(&self) -> Result<Vec<Scheduled>, NotifyError> { ... }
    fn cancel_scheduled(&self, tag: &str) -> Result<(), NotifyError> { ... }
}
Expand description

Host-owned user notifications.

Required Methods§

fn show(&self, notification: &Notification) -> Result<(), NotifyError>

Show notification, replacing any earlier one with the same tag.

fn withdraw(&self, tag: &str) -> Result<(), NotifyError>

Withdraw the notification shown under tag, if any.

Provided Methods§

fn schedule( &self, notification: &Notification, at: SystemTime, ) -> Result<(), NotifyError>

Have the platform show notification at at, even if this app is no longer running. Scheduling a tag again replaces the earlier one.

§Errors

Feature::Schedule is unsupported here, or the platform refused.

fn schedule_alarm( &self, notification: &Notification, at: SystemTime, schedule: AlarmSchedule, ) -> Result<(), NotifyError>

Schedule a local-time alarm. Hosts that understand calendar alarms retain recurrence and timezone semantics after the app closes; other hosts retain the supplied next occurrence through schedule.

fn alarm_states(&self) -> Result<Vec<AlarmState>, NotifyError>

Calendar handoffs and delivered occurrences owned by this app. Hosts that retain only an absolute deadline return no calendar state.

fn scheduled(&self) -> Result<Vec<Scheduled>, NotifyError>

The notifications this app has scheduled that are not yet delivered.

§Errors

As schedule.

fn cancel_scheduled(&self, tag: &str) -> Result<(), NotifyError>

Cancel the scheduled notification under tag, if any.

§Errors

As schedule.

Implementors§