Struct fcm::NotificationBuilder
source · pub struct NotificationBuilder<'a> { /* private fields */ }
Expand description
A builder to get a Notification
instance.
Examples
use fcm::NotificationBuilder;
let mut builder = NotificationBuilder::new();
builder.body("3 runs to win in 1 ball");
let notification = builder.finalize();
Implementations
sourceimpl<'a> NotificationBuilder<'a>
impl<'a> NotificationBuilder<'a>
sourcepub fn new() -> NotificationBuilder<'a>
pub fn new() -> NotificationBuilder<'a>
Get a new NotificationBuilder
instance, with a title.
pub fn title(&mut self, title: &'a str) -> &mut Self
sourcepub fn tag(&mut self, tag: &'a str) -> &mut Self
pub fn tag(&mut self, tag: &'a str) -> &mut Self
Tagging a notification allows you to replace existing notifications with the same tag with this new notification
sourcepub fn click_action(&mut self, click_action: &'a str) -> &mut Self
pub fn click_action(&mut self, click_action: &'a str) -> &mut Self
What happens when the user clicks on the notification. Refer to https://developers.google.com/cloud-messaging/http-server-ref#table2 for details.
sourcepub fn body_loc_key(&mut self, body_loc_key: &'a str) -> &mut Self
pub fn body_loc_key(&mut self, body_loc_key: &'a str) -> &mut Self
Set the body key string for localization
sourcepub fn body_loc_args<S>(&mut self, body_loc_args: &'a [S]) -> &mut Selfwhere
S: Into<Cow<'a, str>> + AsRef<str>,
pub fn body_loc_args<S>(&mut self, body_loc_args: &'a [S]) -> &mut Selfwhere
S: Into<Cow<'a, str>> + AsRef<str>,
String value to replace format specifiers in the body string.
sourcepub fn title_loc_key(&mut self, title_loc_key: &'a str) -> &mut Self
pub fn title_loc_key(&mut self, title_loc_key: &'a str) -> &mut Self
Set the title key string for localization
sourcepub fn title_loc_args<S>(&mut self, title_loc_args: &'a [S]) -> &mut Selfwhere
S: Into<Cow<'a, str>> + AsRef<str>,
pub fn title_loc_args<S>(&mut self, title_loc_args: &'a [S]) -> &mut Selfwhere
S: Into<Cow<'a, str>> + AsRef<str>,
String value to replace format specifiers in the title string.
sourcepub fn finalize(self) -> Notification<'a>
pub fn finalize(self) -> Notification<'a>
Complete the build and get a Notification
instance
Auto Trait Implementations
impl<'a> RefUnwindSafe for NotificationBuilder<'a>
impl<'a> Send for NotificationBuilder<'a>
impl<'a> Sync for NotificationBuilder<'a>
impl<'a> Unpin for NotificationBuilder<'a>
impl<'a> UnwindSafe for NotificationBuilder<'a>
Blanket Implementations
sourceimpl<T> BorrowMut<T> for Twhere
T: ?Sized,
impl<T> BorrowMut<T> for Twhere
T: ?Sized,
const: unstable · sourcefn borrow_mut(&mut self) -> &mut T
fn borrow_mut(&mut self) -> &mut T
Mutably borrows from an owned value. Read more