Struct a2::SilentNotificationBuilder [−][src]
A builder to create an APNs silent notification payload which can be used to
send custom data to the user’s phone if the user hasn’t been running the app
for a while. The custom data needs to be implementing Serialize
from Serde.
Example
let mut test_data = HashMap::new(); test_data.insert("a", "value"); let mut payload = SilentNotificationBuilder::new() .build("device_id", Default::default()); payload.add_custom_data("custom", &test_data); assert_eq!( "{\"aps\":{\"content-available\":1},\"custom\":{\"a\":\"value\"}}", &payload.to_json_string().unwrap() );
Implementations
impl SilentNotificationBuilder
[src]
pub fn new() -> SilentNotificationBuilder
[src]
Creates a new builder.
let payload = SilentNotificationBuilder::new() .build("token", Default::default()); assert_eq!( "{\"aps\":{\"content-available\":1}}", &payload.to_json_string().unwrap() );
Trait Implementations
impl<'a> NotificationBuilder<'a> for SilentNotificationBuilder
[src]
fn build(
self,
device_token: &'a str,
options: NotificationOptions<'a>
) -> Payload<'a>
[src]
self,
device_token: &'a str,
options: NotificationOptions<'a>
) -> Payload<'a>
Auto Trait Implementations
impl RefUnwindSafe for SilentNotificationBuilder
impl Send for SilentNotificationBuilder
impl Sync for SilentNotificationBuilder
impl Unpin for SilentNotificationBuilder
impl UnwindSafe for SilentNotificationBuilder
Blanket Implementations
impl<T> Any for T where
T: 'static + ?Sized,
[src]
T: 'static + ?Sized,
impl<T> Borrow<T> for T where
T: ?Sized,
[src]
T: ?Sized,
impl<T> BorrowMut<T> for T where
T: ?Sized,
[src]
T: ?Sized,
pub fn borrow_mut(&mut self) -> &mut T
[src]
impl<T> From<T> for T
[src]
impl<T> Instrument for T
[src]
pub fn instrument(self, span: Span) -> Instrumented<Self>
[src]
pub fn in_current_span(self) -> Instrumented<Self>
[src]
impl<T> Instrument for T
[src]
pub fn instrument(self, span: Span) -> Instrumented<Self>
[src]
pub fn in_current_span(self) -> Instrumented<Self>
[src]
impl<T, U> Into<U> for T where
U: From<T>,
[src]
U: From<T>,
impl<T, U> TryFrom<U> for T where
U: Into<T>,
[src]
U: Into<T>,
type Error = Infallible
The type returned in the event of a conversion error.
pub fn try_from(value: U) -> Result<T, <T as TryFrom<U>>::Error>
[src]
impl<T, U> TryInto<U> for T where
U: TryFrom<T>,
[src]
U: TryFrom<T>,