NotificationDataSet

Struct NotificationDataSet 

Source
pub struct NotificationDataSet { /* private fields */ }

Implementations§

Source§

impl NotificationDataSet

Source

pub fn new() -> Result<Self, NotifError>

Examples found in repository?
examples/downloading.rs (line 31)
11pub fn main() {
12  let notifier = ToastsNotifier::new("Microsoft.Windows.Explorer").unwrap();
13
14  let notification = NotificationBuilder::new()
15    .with_scenario(Scenario::IncomingCall)
16    .with_use_button_style(true)
17    .visual(
18      Text::create_binded(1, "status")
19    )
20    .visual(
21      Progress::create(AdaptiveText::BindTo("typeof"), ProgressValue::BindTo("value"))
22    )
23    .value("status", "AHQ Store")
24    .value("typeof", "Downloading...")
25    .value("value", "indeterminate")
26    .build(1, &notifier, "a", "ahq")
27    .expect("Error");
28
29  notification.show().expect("Not Sent");
30
31  let data = NotificationDataSet::new().unwrap();
32  for perc in 1..=100 {
33    data.insert("value", format!("{}", perc as f32 / 100.0).as_str()).unwrap();
34
35    _ = notifier.update(&data, "ahq", "a");
36
37    sleep(Duration::from_millis(100));
38  }
39}
More examples
Hide additional examples
examples/readme.rs (line 42)
7fn main() {
8  let path = absolute("./examples/ahq.png").unwrap();
9  let path = path.to_string_lossy();
10
11  let notifier = ToastsNotifier::new("Microsoft.Windows.Explorer").unwrap();
12
13  let notif = NotificationBuilder::new()
14    .visual(
15      Text::create(0, "Welcome to \"win32_notif\"!! 👋")
16        .with_align_center(true)
17        .with_wrap(true)
18        .with_style(HintStyle::Title)
19    )
20    .visual(
21      Text::create_binded(1, "desc")
22        .with_align_center(true)
23        .with_wrap(true)
24        .with_style(HintStyle::Body)
25    )
26    .visual(
27      Image::create(2, format!("file:///{path}").as_str())
28        .with_align(AdaptiveImageAlign::Default)
29        .with_alt("AHQ Logo")
30        .with_crop(ImageCrop::Circle)
31        .with_placement(Placement::AppLogoOverride)
32    )
33    .value("desc", "Data binding works as well {WOW}!")
34    .build(0, &notifier, "01", "readme")
35    .unwrap();
36
37  notif.show()
38    .unwrap();
39
40  sleep(Duration::from_secs(1));
41
42  let data = NotificationDataSet::new().unwrap();
43
44  data.insert("desc", "Hello, the message is edited").unwrap();
45
46  notifier.update(&data, "readme", "01").unwrap();
47}
Source

pub fn insert(&self, k: &str, v: &str) -> Result<bool, NotifError>

Examples found in repository?
examples/downloading.rs (line 33)
11pub fn main() {
12  let notifier = ToastsNotifier::new("Microsoft.Windows.Explorer").unwrap();
13
14  let notification = NotificationBuilder::new()
15    .with_scenario(Scenario::IncomingCall)
16    .with_use_button_style(true)
17    .visual(
18      Text::create_binded(1, "status")
19    )
20    .visual(
21      Progress::create(AdaptiveText::BindTo("typeof"), ProgressValue::BindTo("value"))
22    )
23    .value("status", "AHQ Store")
24    .value("typeof", "Downloading...")
25    .value("value", "indeterminate")
26    .build(1, &notifier, "a", "ahq")
27    .expect("Error");
28
29  notification.show().expect("Not Sent");
30
31  let data = NotificationDataSet::new().unwrap();
32  for perc in 1..=100 {
33    data.insert("value", format!("{}", perc as f32 / 100.0).as_str()).unwrap();
34
35    _ = notifier.update(&data, "ahq", "a");
36
37    sleep(Duration::from_millis(100));
38  }
39}
More examples
Hide additional examples
examples/readme.rs (line 44)
7fn main() {
8  let path = absolute("./examples/ahq.png").unwrap();
9  let path = path.to_string_lossy();
10
11  let notifier = ToastsNotifier::new("Microsoft.Windows.Explorer").unwrap();
12
13  let notif = NotificationBuilder::new()
14    .visual(
15      Text::create(0, "Welcome to \"win32_notif\"!! 👋")
16        .with_align_center(true)
17        .with_wrap(true)
18        .with_style(HintStyle::Title)
19    )
20    .visual(
21      Text::create_binded(1, "desc")
22        .with_align_center(true)
23        .with_wrap(true)
24        .with_style(HintStyle::Body)
25    )
26    .visual(
27      Image::create(2, format!("file:///{path}").as_str())
28        .with_align(AdaptiveImageAlign::Default)
29        .with_alt("AHQ Logo")
30        .with_crop(ImageCrop::Circle)
31        .with_placement(Placement::AppLogoOverride)
32    )
33    .value("desc", "Data binding works as well {WOW}!")
34    .build(0, &notifier, "01", "readme")
35    .unwrap();
36
37  notif.show()
38    .unwrap();
39
40  sleep(Duration::from_secs(1));
41
42  let data = NotificationDataSet::new().unwrap();
43
44  data.insert("desc", "Hello, the message is edited").unwrap();
45
46  notifier.update(&data, "readme", "01").unwrap();
47}
Source

pub fn inner_win32_type(&self) -> &NotificationData

Auto Trait Implementations§

Blanket Implementations§

Source§

impl<T> Any for T
where T: 'static + ?Sized,

Source§

fn type_id(&self) -> TypeId

Gets the TypeId of self. Read more
Source§

impl<T> Borrow<T> for T
where T: ?Sized,

Source§

fn borrow(&self) -> &T

Immutably borrows from an owned value. Read more
Source§

impl<T> BorrowMut<T> for T
where T: ?Sized,

Source§

fn borrow_mut(&mut self) -> &mut T

Mutably borrows from an owned value. Read more
Source§

impl<T> From<T> for T

Source§

fn from(t: T) -> T

Returns the argument unchanged.

Source§

impl<T, U> Into<U> for T
where U: From<T>,

Source§

fn into(self) -> U

Calls U::from(self).

That is, this conversion is whatever the implementation of From<T> for U chooses to do.

Source§

impl<T, U> TryFrom<U> for T
where U: Into<T>,

Source§

type Error = Infallible

The type returned in the event of a conversion error.
Source§

fn try_from(value: U) -> Result<T, <T as TryFrom<U>>::Error>

Performs the conversion.
Source§

impl<T, U> TryInto<U> for T
where U: TryFrom<T>,

Source§

type Error = <U as TryFrom<T>>::Error

The type returned in the event of a conversion error.
Source§

fn try_into(self) -> Result<U, <U as TryFrom<T>>::Error>

Performs the conversion.