pub struct NotificationDataSet { /* private fields */ }Implementations§
Source§impl NotificationDataSet
impl NotificationDataSet
Sourcepub fn new() -> Result<Self, NotifError>
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, ¬ifier, "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
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, ¬ifier, "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}Sourcepub fn insert(&self, k: &str, v: &str) -> Result<bool, NotifError>
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, ¬ifier, "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
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, ¬ifier, "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}pub fn inner_win32_type(&self) -> &NotificationData
Auto Trait Implementations§
impl Freeze for NotificationDataSet
impl RefUnwindSafe for NotificationDataSet
impl Send for NotificationDataSet
impl Sync for NotificationDataSet
impl Unpin for NotificationDataSet
impl UnwindSafe for NotificationDataSet
Blanket Implementations§
Source§impl<T> BorrowMut<T> for Twhere
T: ?Sized,
impl<T> BorrowMut<T> for Twhere
T: ?Sized,
Source§fn borrow_mut(&mut self) -> &mut T
fn borrow_mut(&mut self) -> &mut T
Mutably borrows from an owned value. Read more