Skip to main content

Notice

Struct Notice 

Source
pub struct Notice<M> { /* private fields */ }
Expand description

A notification to show on screen, from Widget::notices.

It says what the notification is, not how it looks: the host lays out the notification, places it and animates it in and out. Its key is how the host tells notices apart from one view to the next: a notice that keeps its key and changes its text is updated in place, and one whose key is gone from the list leaves the screen.

Implementations§

Source§

impl<M> Notice<M>

Source

pub fn new(key: u64, summary: impl Into<String>) -> Self

Source

pub fn app(self, name: impl Into<String>) -> Self

The name of the app it comes from.

Source

pub fn app_icon(self, app_id: impl Into<String>) -> Self

The app’s icon, by app id, like app_icon.

Source

pub fn body(self, text: impl Into<String>) -> Self

Plain text under the summary. The host wraps it and cuts it off after a few lines.

Source

pub fn urgency(self, urgency: Urgency) -> Self

Source

pub fn action(self, label: impl Into<String>, message: M) -> Self

A button on the notification that sends message. The first one is the main action.

Source

pub fn on_press(self, message: M) -> Self

Sent on a click on the notification itself, outside its buttons.

Source

pub fn on_dismiss(self, message: M) -> Self

Sent when its close button is clicked. Without it, it has none.

Source

pub fn expires(self, after: Duration, message: M) -> Self

Sent once it has been on screen for after. The host doesn’t count while the pointer is on it or it’s waiting to be shown. Without it, it stays until it leaves the list.

Source

pub fn reply(self, reply: Reply<M>) -> Self

A field to type an answer into (Reply).

Source

pub fn map<N: 'static>( self, f: &(impl Fn(M) -> N + Clone + 'static), ) -> Notice<N>
where M: 'static,

Source

pub fn key(&self) -> u64

Auto Trait Implementations§

§

impl<M> !RefUnwindSafe for Notice<M>

§

impl<M> !Send for Notice<M>

§

impl<M> !Sync for Notice<M>

§

impl<M> !UnwindSafe for Notice<M>

§

impl<M> Freeze for Notice<M>
where Vec<(String, M)>: Freeze, Option<M>: Freeze, Option<(Duration, M)>: Freeze, Option<Reply<M>>: Freeze,

§

impl<M> Unpin for Notice<M>
where Vec<(String, M)>: Unpin, Option<M>: Unpin, Option<(Duration, M)>: Unpin, Option<Reply<M>>: Unpin,

§

impl<M> UnsafeUnpin for Notice<M>

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> 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.