Skip to main content

Notification

Struct Notification 

Source
pub struct Notification { /* private fields */ }
Expand description

A notification (see notify).

Implementations§

Source§

impl Notification

Source

pub fn new(title: &str) -> Self

A notification titled title.

Source

pub fn subtitle(self, text: &str) -> Self

A second line under the title, in bold.

Source

pub fn body(self, text: &str) -> Self

The message.

Source

pub fn sound(self) -> Self

Plays the system’s notification sound.

Source

pub fn id(self, id: &str) -> Self

Its identifier: a new notification with the same one replaces it in Notification Center (a download’s progress, today’s summary).

Source

pub fn daily_at(self, hour: u32, minute: u32) -> Self

Shows it every day at hour:minute local time (a habit’s reminder) instead of now, until cancel_notification with its id. Posting another with the same id replaces it.

Source

pub fn on_click(self, action: impl Fn() + 'static) -> Self

Runs action when the user clicks the notification (the app comes to the front first), while the app is still running.

Auto Trait Implementations§

Blanket Implementations§

Source§

impl<T> Any for T
where T: 'static + ?Sized,

Source§

fn type_id(&self) -> TypeId

Gets the TypeId of self. Read more
Source§

impl<T> AutoreleaseSafe for T
where T: ?Sized,

Source§

impl<T> Borrow<T> for T
where T: ?Sized,

Source§

fn borrow(&self) -> &T

Immutably borrows from an owned value. Read more
Source§

impl<T> BorrowMut<T> for T
where T: ?Sized,

Source§

fn borrow_mut(&mut self) -> &mut T

Mutably borrows from an owned value. Read more
Source§

impl<T> From<T> for T

Source§

fn from(t: T) -> T

Returns the argument unchanged.

Source§

impl<T, U> Into<U> for T
where U: From<T>,

Source§

fn into(self) -> U

Calls U::from(self).

That is, this conversion is whatever the implementation of From<T> for U chooses to do.

Source§

impl<T, U> TryFrom<U> for T
where U: Into<T>,

Source§

type Error = !

The type returned in the event of a conversion error.
Source§

fn try_from(value: U) -> Result<T, !>

Performs the conversion.
Source§

impl<T, U> TryInto<U> for T
where U: TryFrom<T>,

Source§

type Error = <U as TryFrom<T>>::Error

The type returned in the event of a conversion error.
Source§

fn try_into(self) -> Result<U, <U as TryFrom<T>>::Error>

Performs the conversion.