pub struct DesktopNotification {
pub title: String,
pub body: String,
pub icon: Option<String>,
pub timeout_ms: i32,
pub category: Option<String>,
}Expand description
Cross-platform desktop notification descriptor.
Fields§
§title: String§body: String§icon: Option<String>§timeout_ms: i32§category: Option<String>Implementations§
Source§impl DesktopNotification
impl DesktopNotification
Sourcepub fn new(title: impl Into<String>, body: impl Into<String>) -> Self
pub fn new(title: impl Into<String>, body: impl Into<String>) -> Self
Creates a new desktop notification with title and body.
Sourcepub fn with_icon(self, icon: impl Into<String>) -> Self
pub fn with_icon(self, icon: impl Into<String>) -> Self
Sets the notification icon name or URI.
Sourcepub fn with_timeout(self, timeout_ms: i32) -> Self
pub fn with_timeout(self, timeout_ms: i32) -> Self
Sets the notification expiration timeout in milliseconds.
Sourcepub fn with_category(self, category: impl Into<String>) -> Self
pub fn with_category(self, category: impl Into<String>) -> Self
Sets the notification category.
Sourcepub fn show(&self) -> Result<u32, String>
pub fn show(&self) -> Result<u32, String>
Dispatches the notification to the operating system notification service.
- On Linux: emits over session D-Bus
org.freedesktop.Notifications.Notify. - On Windows: emits balloon notification via
Shell_NotifyIconW. - On macOS: emits native Notification via
NSUserNotificationCenter. - In test/fallback mode: records to process memory and returns unique ID.
Trait Implementations§
Source§impl Clone for DesktopNotification
impl Clone for DesktopNotification
Source§impl Debug for DesktopNotification
impl Debug for DesktopNotification
Source§impl PartialEq for DesktopNotification
impl PartialEq for DesktopNotification
impl StructuralPartialEq for DesktopNotification
Auto Trait Implementations§
impl Forget for DesktopNotification
impl Freeze for DesktopNotification
impl Move for DesktopNotification
impl RefUnwindSafe for DesktopNotification
impl Send for DesktopNotification
impl Sync for DesktopNotification
impl Unpin for DesktopNotification
impl UnsafeUnpin for DesktopNotification
impl UnwindSafe for DesktopNotification
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