pub struct PushMessage {
pub token: DeviceToken,
pub title: String,
pub body: String,
pub data: BTreeMap<String, String>,
pub channel_id: Option<String>,
}Expand description
One notification addressed to a single device token.
data travels alongside the visible notification and reaches the app when
the user opens it. Keys are ordered so the serialized payload is stable,
which keeps request bodies comparable in tests and logs.
Fields§
§token: DeviceTokenProvider-issued device token the notification is delivered to.
title: StringNotification title shown on the device.
body: StringNotification body shown on the device.
data: BTreeMap<String, String>Optional key-value payload delivered with the notification.
channel_id: Option<String>Provider channel the notification belongs to, when the platform has channels.
Android reads this to pick the notification channel. Leave it None for
the provider default.
Implementations§
Source§impl PushMessage
impl PushMessage
Sourcepub fn new(
token: DeviceToken,
title: impl Into<String>,
body: impl Into<String>,
) -> Self
pub fn new( token: DeviceToken, title: impl Into<String>, body: impl Into<String>, ) -> Self
Creates a message for a token with a title and body and no extra data.
Sourcepub fn with_data(self, key: impl Into<String>, value: impl Into<String>) -> Self
pub fn with_data(self, key: impl Into<String>, value: impl Into<String>) -> Self
Adds one key-value pair to the notification payload.
Sourcepub fn with_channel_id(self, channel_id: impl Into<String>) -> Self
pub fn with_channel_id(self, channel_id: impl Into<String>) -> Self
Sets the provider channel the notification belongs to.
Trait Implementations§
Source§impl Clone for PushMessage
impl Clone for PushMessage
Source§impl Debug for PushMessage
impl Debug for PushMessage
impl Eq for PushMessage
Source§impl PartialEq for PushMessage
impl PartialEq for PushMessage
impl StructuralPartialEq for PushMessage
Auto Trait Implementations§
impl Freeze for PushMessage
impl RefUnwindSafe for PushMessage
impl Send for PushMessage
impl Sync for PushMessage
impl Unpin for PushMessage
impl UnsafeUnpin for PushMessage
impl UnwindSafe for PushMessage
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> CloneToUninit for Twhere
T: Clone,
impl<T> CloneToUninit for Twhere
T: Clone,
Source§impl<Q, K> Equivalent<K> for Q
impl<Q, K> Equivalent<K> for Q
Source§impl<Q, K> Equivalent<K> for Q
impl<Q, K> Equivalent<K> for Q
Source§impl<Q, K> Equivalent<K> for Q
impl<Q, K> Equivalent<K> for Q
Source§impl<Q, K> Equivalent<K> for Q
impl<Q, K> Equivalent<K> for Q
Source§fn equivalent(&self, key: &K) -> bool
fn equivalent(&self, key: &K) -> bool
key and return true if they are equal.