diff --git a/src/wrappers/builder.rs b/src/wrappers/builder.rs index afd4a14..b5e5fda 100644 --- a/src/wrappers/builder.rs +++ b/src/wrappers/builder.rs @@ -34,42 +34,62 @@ impl<'a> NotificationBuilder<'a> { } /// Sets app name for this specific notification. - pub fn set_app_name(mut self, app_name: &str) -> Result { - self.notification.set_app_name(app_name)?; + pub fn set_app_name>>( + mut self, + app_name: T, + ) -> Result { + if let Some(app_name) = app_name.into() { + self.notification.set_app_name(app_name)?; + } + Ok(self) } /// Sets app icon fot this specific notification. - pub fn set_app_icon(mut self, app_icon: &str) -> Result { - self.notification.set_app_icon(app_icon)?; + pub fn set_app_icon>>( + mut self, + app_icon: T, + ) -> Result { + if let Some(app_icon) = app_icon.into() { + self.notification.set_app_icon(app_icon)?; + } + Ok(self) } /// Sets category for this specific notification - pub fn set_category(mut self, category: &str) -> Result { - self.notification.set_category(category)?; + pub fn set_category>>( + mut self, + category: T, + ) -> Result { + if let Some(category) = category.into() { + self.notification.set_category(category)?; + } + Ok(self) } /// Set hint for this specific notification - pub fn set_hint( - mut self, - key: &str, - value: HintValue, - ) -> Result> { + pub fn set_hint(mut self, key: &str, value: HintValue) -> Result { self.notification.set_hint(key, value)?; Ok(self) } /// Set timeout until close - pub fn set_timeout(mut self, timeout: Timeout) -> Self { - self.notification.set_timeout(timeout); + pub fn set_timeout>>(mut self, timeout: T) -> Self { + if let Some(timeout) = timeout.into() { + self.notification.set_timeout(timeout); + } + self } /// Set notification urgency level - pub fn set_urgency(mut self, urgency: Urgency) -> Self { - self.notification.set_urgency(urgency); + pub fn set_urgency>>(mut self, urgency: T) -> Self { + if let Some(urgency) = urgency.into() { + self.notification.set_urgency(urgency); + } + self }