Expand description
A mostly usable binding to the Windows ToastNotification
API.
§Example
use winrt_toast::{Toast, Text, Header, ToastManager};
use winrt_toast::content::text::TextPlacement;
let manager = ToastManager::new("YourCompany.YourApp");
let mut toast = Toast::new();
toast
.text1("Title")
.text2(Text::new("Body"))
.text3(
Text::new("Via SMS")
.with_placement(TextPlacement::Attribution)
);
manager.show(&toast).expect("Failed to show toast");
// Or you may add callbacks
manager.show_with_callbacks(
&toast, None, None,
Some(Box::new(move |e| {
// This will be called if Windows fails to show the toast.
eprintln!("Failed to show toast: {:?}", e);
}))
).expect("Failed to show toast");
Re-exports§
pub use content::header::Header;
pub use content::image::Image;
pub use content::text::Text;
pub use content::action::Action;
pub use url;
Modules§
- content
- Contents in a toast notification.
Structs§
- Toast
- Represents a Windows toast.
- Toast
Manager - An interface that provides access to the toast notification manager.
Enums§
- Dismissal
Reason - Specifies the reason that a toast notification is no longer being shown
- Scenario
- The scenario your toast is used for, like an alarm or reminder.
- Toast
Duration - The amount of time the toast should display
- WinToast
Error - The error type used in this crate.
Functions§
- register
- Register the application to Windows registry.
Type Aliases§
- Result
- The result type used in this crate.