pub fn on_close<A>(self, handler: impl CloseHandler<A>) {
        match self.inner {
            #[cfg(feature = "dbus")]
            NotificationHandleInner::Dbus(inner) => inner.wait_for_action(|action: &ActionResponse| {
                if let ActionResponse::Closed(reason) = action {
                    handler.call(*reason);
                }
            }),
            #[cfg(feature = "zbus")]
            NotificationHandleInner::Zbus(inner) => inner.wait_for_action(|action: &ActionResponse| {
                if let ActionResponse::Closed(reason) = action {
                    handler.call(*reason);
                }
            }),
        };
    }
/// Executes a closure after the notification has closed.
///
/// ## Example 1: *I don't care about why it closed* (the good ole API)
///
/// ```no_run
/// # use notify_rust::Notification;
/// Notification::new().summary("Time is running out")
///                    .body("This will go away.")
///                    .icon("clock")
///                    .show()
///                    .unwrap()
///                    .on_close(|| println!("closed"));
/// ```
/// 
/// ## Example 2: *I **do** care about why it closed* (added in v4.5.0)
///
/// ```no_run
/// # use notify_rust::Notification;
/// Notification::new().summary("Time is running out")
///                    .body("This will go away.")
///                    .icon("clock")
///                    .show()
///                    .unwrap()
///                    .on_close(|reason| println!("closed: {:?}", reason));
/// ```
Executes a closure after the notification has closed.
Executes a closure after the notification has closed .
pub fn on_close<A>(self, handler: impl CloseHandler<A>) {
        match self.inner {
            #[cfg(feature = "dbus")]
            NotificationHandleInner::Dbus(inner) => inner.wait_for_action(|action: &ActionResponse| {
                if let ActionResponse::Closed(reason) = action {
                    handler.call(*reason);
                }
            }),
            #[cfg(feature = "zbus")]
            NotificationHandleInner::Zbus(inner) => inner.wait_for_action(|action: &ActionResponse| {
                if let ActionResponse::Closed(reason) = action {
                    handler.call(*reason);
                }
            }),
        };
    }
pub fn on_close < A > ( self , handler : impl CloseHandler < A > ) { match self . inner { # [ cfg ( feature " " ) ] NotificationHandleInner :: Dbus ( inner ) => inner . wait_for_action ( | action : & ActionResponse | { if let ActionResponse :: Closed ( reason ) = action { handler . call ( * reason ) ; } } ) , # [ cfg ( feature " " ) ] NotificationHandleInner :: Zbus ( inner ) => inner . wait_for_action ( | action : & ActionResponse | { if let ActionResponse :: Closed ( reason ) = action { handler . call ( * reason ) ; } } ) , } ; }
Executes a closure after the notification has closed.
Executes a closure after the notification has closed .
self
handler
impl CloseHandler<A>
self
handler
impl CloseHandler<A>
example 1: *i don't care about why it closed* (the good ole api)
None
use notify_rust::notification;
:new().summary("Time is running out")
.body("This will go away.")
.icon("clock")
.show()
.unwrap()
.on_close(|| println!("closed"));
```
: new () . summary ( " Time is running out " ) . body ( " This will go away . " ) . icon ( " clock " ) . show () . unwrap () . on_close ( || println! ( " closed " )) ; ` ` `
example 2: *i **do** care about why it closed* (added in v4.5.0)
None
use notify_rust::notification;
:new().summary("Time is running out")
.body("This will go away.")
.icon("clock")
.show()
.unwrap()
.on_close(|reason| println!("closed: {:?}", reason));
```
: new () . summary ( " Time is running out " ) . body ( " This will go away . " ) . icon ( " clock " ) . show () . unwrap () . on_close ( |reason| println! ( " closed : { : ? } " reason )) ; ` ` `