pub enum NotificationResponse {
Default,
Action(String),
Reply(String),
Closed(CloseReason),
}Expand description
The outcome of a shown notification.
Returned by wait_for_response.
Match on this to handle every possible outcome:
match response {
NotificationResponse::Default => println!("body clicked"),
NotificationResponse::Action(ref key) => println!("button '{key}' clicked"),
NotificationResponse::Reply(ref text) => println!("user replied: {text}"),
NotificationResponse::Closed(reason) => println!("closed: {reason:?}"),
}Variants§
Default
The default action was invoked — the user activated the notification without choosing a specific button (e.g. clicked the body, tapped the banner).
Corresponds to the D-Bus "default" action key,
Apple’s UNNotificationDefaultActionIdentifier, and a body-click on Windows.
Action(String)
The user invoked a named action button.
Reply(String)
The user submitted an inline text reply.
Only produced by the preview-macos-un backend (macOS UNUserNotificationCenter
with an inline reply action). On all other backends this variant is never emitted.
Closed(CloseReason)
The notification was closed without any action being taken.
Implementations§
Source§impl NotificationResponse
impl NotificationResponse
Sourcepub fn is_default_action(&self) -> bool
pub fn is_default_action(&self) -> bool
Returns true if this response is the Default variant.
Trait Implementations§
Source§impl Clone for NotificationResponse
impl Clone for NotificationResponse
Source§fn clone(&self) -> NotificationResponse
fn clone(&self) -> NotificationResponse
Returns a duplicate of the value. Read more
1.0.0 (const: unstable) · Source§fn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
Performs copy-assignment from
source. Read moreSource§impl Debug for NotificationResponse
impl Debug for NotificationResponse
impl Eq for NotificationResponse
Source§impl From<&str> for NotificationResponse
impl From<&str> for NotificationResponse
Source§impl From<String> for NotificationResponse
impl From<String> for NotificationResponse
Source§impl Hash for NotificationResponse
impl Hash for NotificationResponse
Source§impl PartialEq for NotificationResponse
impl PartialEq for NotificationResponse
Source§fn eq(&self, other: &NotificationResponse) -> bool
fn eq(&self, other: &NotificationResponse) -> bool
Tests for
self and other values to be equal, and is used by ==.impl StructuralPartialEq for NotificationResponse
Auto Trait Implementations§
impl Freeze for NotificationResponse
impl RefUnwindSafe for NotificationResponse
impl Send for NotificationResponse
impl Sync for NotificationResponse
impl Unpin for NotificationResponse
impl UnsafeUnpin for NotificationResponse
impl UnwindSafe for NotificationResponse
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