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>
impl<M> Notice<M>
pub fn new(key: u64, summary: impl Into<String>) -> Self
Sourcepub fn app_icon(self, app_id: impl Into<String>) -> Self
pub fn app_icon(self, app_id: impl Into<String>) -> Self
The app’s icon, by app id, like app_icon.
Sourcepub fn image(self, url: impl Into<String>) -> Self
pub fn image(self, url: impl Into<String>) -> Self
A picture to show instead of the app’s icon, by URL, like a cover: an icon file the
app gave as a path.
Sourcepub fn body(self, text: impl Into<String>) -> Self
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.
pub fn urgency(self, urgency: Urgency) -> Self
Sourcepub fn action(self, label: impl Into<String>, message: M) -> Self
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.
Sourcepub fn on_press(self, message: M) -> Self
pub fn on_press(self, message: M) -> Self
Sent on a click on the notification itself, outside its buttons.
Sourcepub fn on_dismiss(self, message: M) -> Self
pub fn on_dismiss(self, message: M) -> Self
Sent when its close button is clicked. Without it, it has none.
Sourcepub fn expires(self, after: Duration, message: M) -> Self
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.