win7_notifications/
lib.rs

1// Copyright 2020-2022 Tauri Programme within The Commons Conservancy
2// SPDX-License-Identifier: Apache-2.0
3// SPDX-License-Identifier: MIT
4
5//! Send Windows 10 styled notifications on Windows 7.
6//!
7//! # Note:
8//!
9//! This crate requires a win32 event loop to be running on the thread, otherwise the notification will close immediately,
10//! it is recommended to use it with other win32 event loop crates like [winit](https://docs.rs/winit) or just use your own win32 event loop.
11//!
12//! # Examples
13//!
14//! # Example 1: Simple Notification
15//!
16//! ```no_run
17//! # use win7_notifications::*;
18//! # let icon = &[];
19//! Notification::new()
20//!     .appname("App name")
21//!     .summary("Critical Error")
22//!     .body("Just kidding, this is just the notification example.")
23//!     .icon(icon.to_vec(), 32, 32)
24//!     .timeout(Timeout::Default) // 5000 milliseconds
25//!     .show().unwrap();
26//! ```
27//!
28//! # Example 2: Presistent Notification
29//!
30//! ```no_run
31//! # use win7_notifications::*;
32//! # let icon = &[];
33//! Notification::new()
34//!     .appname("App name")
35//!     .summary("Critical Error")
36//!     .body("Just kidding, this is just the notification example.")
37//!     .icon(icon.to_vec(), 32, 32)
38//!     .timeout(Timeout::Never)
39//!     .show().unwrap();
40//! ```
41//!
42
43mod notification;
44mod timeout;
45mod util;
46
47pub use crate::{notification::Notification, timeout::Timeout};