Struct winrt_toast::Toast
source · [−]pub struct Toast { /* private fields */ }
Expand description
Represents a Windows toast.
See https://docs.microsoft.com/en-us/uwp/api/windows.ui.notifications.toastnotification
Implementations
sourceimpl Toast
impl Toast
sourcepub fn text1<T: Into<Text>>(&mut self, text: T) -> &mut Toast
pub fn text1<T: Into<Text>>(&mut self, text: T) -> &mut Toast
The first text element, usually the title.
Example
// You can use anything that is Into<String>
toast.text1("text");
// Or you can use a `Text`
toast.text1(
Text::new("text").with_placement(TextPlacement::Attribution)
);
sourcepub fn text2<T: Into<Text>>(&mut self, text: T) -> &mut Toast
pub fn text2<T: Into<Text>>(&mut self, text: T) -> &mut Toast
The second text element, usually the body.
sourcepub fn text3<T: Into<Text>>(&mut self, text: T) -> &mut Toast
pub fn text3<T: Into<Text>>(&mut self, text: T) -> &mut Toast
The third text element, usually the body or attribution.
sourcepub fn image(&mut self, id: u8, image: Image) -> &mut Toast
pub fn image(&mut self, id: u8, image: Image) -> &mut Toast
Add an image with the corresponding ID to the toast.
ID
The image element in the toast template that this image is intended for. If a template has only one image, then this value is 1. The number of available image positions is based on the template definition.
sourcepub fn remote_id(&mut self, remote_id: impl Into<String>) -> &mut Toast
pub fn remote_id(&mut self, remote_id: impl Into<String>) -> &mut Toast
Set a remote id for the notification that enables the system to correlate this notification with another one generated on another device.
sourcepub fn scenario(&mut self, scenario: Scenario) -> &mut Toast
pub fn scenario(&mut self, scenario: Scenario) -> &mut Toast
Set the scenario of this toast.
The scenario adjusts a few behaviors to create a consistent and unified user experience.
sourcepub fn launch(&mut self, launch: impl Into<String>) -> &mut Toast
pub fn launch(&mut self, launch: impl Into<String>) -> &mut Toast
A string that is passed to the application when it is activated by the toast.
The format and contents of this string are defined by the app for its own use. When the user taps or clicks the toast to launch its associated app, the launch string provides the context to the app that allows it to show the user a view relevant to the toast content, rather than launching in its default way.
sourcepub fn duration(&mut self, duration: ToastDuration) -> &mut Toast
pub fn duration(&mut self, duration: ToastDuration) -> &mut Toast
The amount of time the toast should display.
sourcepub fn expires_in(&mut self, duration: Duration) -> &mut Toast
pub fn expires_in(&mut self, duration: Duration) -> &mut Toast
Set the expiration time of this toats, starting from the moment it is shown.
After expiration, the toast will be removed from the Notification Center.
Trait Implementations
Auto Trait Implementations
impl RefUnwindSafe for Toast
impl Send for Toast
impl Sync for Toast
impl Unpin for Toast
impl UnwindSafe for Toast
Blanket Implementations
sourceimpl<T> BorrowMut<T> for T where
T: ?Sized,
impl<T> BorrowMut<T> for T where
T: ?Sized,
const: unstable · sourcefn borrow_mut(&mut self) -> &mut T
fn borrow_mut(&mut self) -> &mut T
Mutably borrows from an owned value. Read more