pub struct NotificationBuilder { /* private fields */ }Expand description
A builder struct for building notifications.
Implementations§
Source§impl NotificationBuilderwhere
Self: Sized,
impl NotificationBuilderwhere
Self: Sized,
Sourcepub fn body(self, body: &str) -> Self
pub fn body(self, body: &str) -> Self
Main content of notification
Plaform specific:
- MacOS: UNNotificationContent/body
- Linux / XDG: body
- Windows: text2
Sourcepub fn title(self, title: &str) -> Self
pub fn title(self, title: &str) -> Self
Primary description of notification
Plaform specific:
- MacOS: UNNotificationContent/title
- Linux / XDG: summary
- Windows: text2
Sourcepub fn subtitle(self, subtitle: &str) -> Self
pub fn subtitle(self, subtitle: &str) -> Self
Sets secondary description of Notification
Plaform specific:
- MacOS UNNotificationContent/subtitle
- Linux / XDG: not suported!
- Windows text1
Sourcepub fn set_image(self, path: PathBuf) -> Self
pub fn set_image(self, path: PathBuf) -> Self
Set Image Attachment
Plaform specific:
- MacOS: passed by file path, must be gif, jpg, or png
- For linux the file is read and transfered over dbus (in case you are in a flatpak and it can’t read from files) “image-data”
- Windows: passed by file path. image
Sourcepub fn set_icon(self, path: PathBuf) -> Self
pub fn set_icon(self, path: PathBuf) -> Self
Set App icon
Plaform specific:
- MacOS: not supported to change the app icon?
- For linux the file is read and transfered over dbus (in case you are in a flatpak and it can’t read from files) app_icon
- Windows:
<image placement="appLogoOverride" />
Sourcepub fn set_icon_round_crop(self, icon_round_crop: bool) -> Self
pub fn set_icon_round_crop(self, icon_round_crop: bool) -> Self
Set App icon to be round
Plaform specific:
- MacOS: not supported
- Linux: not supported
- Windows:
<image placement='appLogoOverride' hint-crop='circle' />
Sourcepub fn set_thread_id(self, thread_id: &str) -> Self
pub fn set_thread_id(self, thread_id: &str) -> Self
Set Thread id, this is used to group related notifications
Plaform specific:
- MacOS: UNNotificationContent/threadIdentifier
- Linux not specified yet:
- Windows: not supported
Sourcepub fn set_category_id(self, category_id: &str) -> Self
pub fn set_category_id(self, category_id: &str) -> Self
Set the notification Category, those are basically templates how the notification should be displayed
It is used to add a text field or buttons to the notification.
Categories are defined by passing them to NotificationManager::register on app startup
Sourcepub fn set_xdg_category(self, category: XdgNotificationCategory) -> Self
pub fn set_xdg_category(self, category: XdgNotificationCategory) -> Self
Set the xdg notification Category
The type of notification this is acording to https://specifications.freedesktop.org/notification-spec/latest/categories.html
Platform specific: only work on linux, this does nothing on other platforms
Sourcepub fn set_xdg_app_name(self, name: String) -> Self
pub fn set_xdg_app_name(self, name: String) -> Self
Set the xdg App Name
Platform specific: only work on linux, this does nothing on other platforms
Sourcepub fn set_user_info(self, user_info: HashMap<String, String>) -> Self
pub fn set_user_info(self, user_info: HashMap<String, String>) -> Self
Set metadata for a notification
§Platform Specific
- on MacOS this uses UserInfo field in the notification content, so it works accross sessions
- windows stores this in toast NotificationData
- linux: on linux we emulate this by storing this info inside of NotificationManager
Trait Implementations§
Source§impl Debug for NotificationBuilder
impl Debug for NotificationBuilder
Source§impl Default for NotificationBuilder
impl Default for NotificationBuilder
Source§fn default() -> NotificationBuilder
fn default() -> NotificationBuilder
Auto Trait Implementations§
impl Freeze for NotificationBuilder
impl RefUnwindSafe for NotificationBuilder
impl Send for NotificationBuilder
impl Sync for NotificationBuilder
impl Unpin for NotificationBuilder
impl UnwindSafe for NotificationBuilder
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
Source§impl<T> Instrument for T
impl<T> Instrument for T
Source§fn instrument(self, span: Span) -> Instrumented<Self>
fn instrument(self, span: Span) -> Instrumented<Self>
Source§fn in_current_span(self) -> Instrumented<Self>
fn in_current_span(self) -> Instrumented<Self>
Source§impl<T> IntoEither for T
impl<T> IntoEither for T
Source§fn into_either(self, into_left: bool) -> Either<Self, Self>
fn into_either(self, into_left: bool) -> Either<Self, Self>
self into a Left variant of Either<Self, Self>
if into_left is true.
Converts self into a Right variant of Either<Self, Self>
otherwise. Read moreSource§fn into_either_with<F>(self, into_left: F) -> Either<Self, Self>
fn into_either_with<F>(self, into_left: F) -> Either<Self, Self>
self into a Left variant of Either<Self, Self>
if into_left(&self) returns true.
Converts self into a Right variant of Either<Self, Self>
otherwise. Read moreSource§impl<T> Pointable for T
impl<T> Pointable for T
Source§impl<R, P> ReadPrimitive<R> for P
impl<R, P> ReadPrimitive<R> for P
Source§fn read_from_little_endian(read: &mut R) -> Result<Self, Error>
fn read_from_little_endian(read: &mut R) -> Result<Self, Error>
ReadEndian::read_from_little_endian().