15 unstable releases (4 breaking)

0.5.1 Jan 11, 2022
0.5.0 Nov 3, 2021
0.4.0 Oct 5, 2021
0.3.1 Apr 10, 2021
0.1.5 Nov 20, 2017

#25 in Windows APIs

Download history 6089/week @ 2022-04-21 7826/week @ 2022-04-28 6463/week @ 2022-05-05 4519/week @ 2022-05-12 5579/week @ 2022-05-19 4692/week @ 2022-05-26 4748/week @ 2022-06-02 6412/week @ 2022-06-09 6097/week @ 2022-06-16 6829/week @ 2022-06-23 7890/week @ 2022-06-30 5955/week @ 2022-07-07 6687/week @ 2022-07-14 6248/week @ 2022-07-21 6851/week @ 2022-07-28 6713/week @ 2022-08-04

27,491 downloads per month
Used in 69 crates (3 directly)

MIT license

35KB
275 lines

winrt-notification

license version Build Status

An incomplete wrapper over the WinRT toast api

Tested in Windows 10 and 8.1. Untested in Windows 8, might work.

0.5 Documentation

0.2 Documentation

Todo:

  • Add support for Adaptive Content
  • Add support for Actions

Known Issues:

  • Will not work for Windows 7.

Limitations:

  • Windows 8.1 only supports a single image, the last image (icon, hero, image) will be the one on the toast

Usage

#Cargo.toml
[dependencies]
winrt-notification = "0.5.1"

Examples

extern crate winrt_notification;
use winrt_notification::{Duration, Sound, Toast};

fn main() {
    Toast::new(Toast::POWERSHELL_APP_ID)
        .title("Look at this flip!")
        .text1("(╯°□°)╯︵ ┻━┻")
        .sound(Some(Sound::SMS))
        .duration(Duration::Short)
        .show()
        .expect("unable to toast");
}
extern crate winrt_notification;
use std::path::Path;
use winrt_notification::{IconCrop, Toast};

fn main() {
    Toast::new("Your AppUserModeId")
        .hero(&Path::new("C:\\absolute\\path\\to\\image.jpeg"), "alt text")
        .icon(
            &Path::new("c:/this/style/works/too/image.png"),
            IconCrop::Circular,
            "alt text",
        )
        .title("Lots of pictures here")
        .text1("One above the text as the hero")
        .text2("One to the left as an icon, and several below")
        .image(&Path::new("c:/photos/sun.png"), "the sun")
        .image(&Path::new("c:/photos/moon.png"), "the moon")
        .sound(None) // will be silent
        .show()
        .expect("unable to toast");
}

Dependencies

~0.9–51MB
~872K SLoC