[][src]Struct fcm::NotificationBuilder

pub struct NotificationBuilder<'a> { /* fields omitted */ }

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();

Methods

impl<'a> NotificationBuilder<'a>[src]

pub fn new() -> NotificationBuilder<'a>[src]

Get a new NotificationBuilder instance, with a title.

pub fn title(&mut self, title: &'a str) -> &mut Self[src]

pub fn body(&mut self, body: &'a str) -> &mut Self[src]

Set the body of the notification

pub fn icon(&mut self, icon: &'a str) -> &mut Self[src]

Set the notification icon.

pub fn sound(&mut self, sound: &'a str) -> &mut Self[src]

Set the sound to be played

pub fn badge(&mut self, badge: &'a str) -> &mut Self[src]

Set the badge for iOS notifications

pub fn tag(&mut self, tag: &'a str) -> &mut Self[src]

Tagging a notification allows you to replace existing notifications with the same tag with this new notification

pub fn color(&mut self, color: &'a str) -> &mut Self[src]

The color of the icon, in #rrggbb format

pub fn click_action(&mut self, click_action: &'a str) -> &mut Self[src]

What happens when the user clicks on the notification. Refer to https://developers.google.com/cloud-messaging/http-server-ref#table2 for details.

pub fn body_loc_key(&mut self, body_loc_key: &'a str) -> &mut Self[src]

Set the body key string for localization

pub fn body_loc_args<S>(&mut self, body_loc_args: &'a [S]) -> &mut Self where
    S: Into<Cow<'a, str>> + AsRef<str>, 
[src]

String value to replace format specifiers in the body string.

pub fn title_loc_key(&mut self, title_loc_key: &'a str) -> &mut Self[src]

Set the title key string for localization

pub fn title_loc_args<S>(&mut self, title_loc_args: &'a [S]) -> &mut Self where
    S: Into<Cow<'a, str>> + AsRef<str>, 
[src]

String value to replace format specifiers in the title string.

pub fn finalize(self) -> Notification<'a>[src]

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

impl<T> Any for T where
    T: 'static + ?Sized
[src]

impl<T> Borrow<T> for T where
    T: ?Sized
[src]

impl<T> BorrowMut<T> for T where
    T: ?Sized
[src]

impl<T> From<T> for T[src]

impl<T, U> Into<U> for T where
    U: From<T>, 
[src]

impl<T, U> TryFrom<U> for T where
    U: Into<T>, 
[src]

type Error = Infallible

The type returned in the event of a conversion error.

impl<T, U> TryInto<U> for T where
    U: TryFrom<T>, 
[src]

type Error = <U as TryFrom<T>>::Error

The type returned in the event of a conversion error.