pub struct Notification {
pub title: Option<String>,
pub body: Option<String>,
pub image: Option<String>,
}
Expand description
Represents a basic template for notifications, which is equal across all platforms.
See https://firebase.google.com/docs/reference/fcm/rest/v1/projects.messages#notification.
Use the Notification::new
function, or initialize the struct yourself:
let notification = Notification {
title: Some("Hello, ").to_string(),
body: Some("world!").to_string(),
image: None,
};
Fields§
§title: Option<String>
§body: Option<String>
§image: Option<String>
Implementations§
Source§impl Notification
impl Notification
Sourcepub fn with_title(self, title: impl Into<String>) -> Self
pub fn with_title(self, title: impl Into<String>) -> Self
Easily create a notification with any type that implements Into<String>
(such as &str
).
let notification = Notification::new().with_title("Hello!");
Sourcepub fn with_body(self, body: impl Into<String>) -> Self
pub fn with_body(self, body: impl Into<String>) -> Self
Easily create a notification with any type that implements Into<String>
(such as &str
).
let notification = Notification::new().with_title("Hello, ").with_body("world!");
Sourcepub fn with_image(self, image: impl Into<String>) -> Self
pub fn with_image(self, image: impl Into<String>) -> Self
Easily create a notification with any type that implements Into<String>
(such as &str
).
let notification = Notification::new().with_image("/static/img.png");
Trait Implementations§
Source§impl Clone for Notification
impl Clone for Notification
Source§fn clone(&self) -> Notification
fn clone(&self) -> Notification
Returns a duplicate of the value. Read more
1.0.0 · Source§const fn clone_from(&mut self, source: &Self)
const fn clone_from(&mut self, source: &Self)
Performs copy-assignment from
source
. Read moreSource§impl Debug for Notification
impl Debug for Notification
Source§impl Default for Notification
impl Default for Notification
Source§fn default() -> Notification
fn default() -> Notification
Returns the “default value” for a type. Read more
Auto Trait Implementations§
impl Freeze for Notification
impl RefUnwindSafe for Notification
impl Send for Notification
impl Sync for Notification
impl Unpin for Notification
impl UnwindSafe for Notification
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
Mutably borrows from an owned value. Read more
Source§impl<T> CloneToUninit for Twhere
T: Clone,
impl<T> CloneToUninit for Twhere
T: Clone,
Source§impl<T> Instrument for T
impl<T> Instrument for T
Source§fn instrument(self, span: Span) -> Instrumented<Self>
fn instrument(self, span: Span) -> Instrumented<Self>
Source§fn in_current_span(self) -> Instrumented<Self>
fn in_current_span(self) -> Instrumented<Self>
Source§impl<T> IntoEither for T
impl<T> IntoEither for T
Source§fn into_either(self, into_left: bool) -> Either<Self, Self>
fn into_either(self, into_left: bool) -> Either<Self, Self>
Converts
self
into a Left
variant of Either<Self, Self>
if into_left
is true
.
Converts self
into a Right
variant of Either<Self, Self>
otherwise. Read moreSource§fn into_either_with<F>(self, into_left: F) -> Either<Self, Self>
fn into_either_with<F>(self, into_left: F) -> Either<Self, Self>
Converts
self
into a Left
variant of Either<Self, Self>
if into_left(&self)
returns true
.
Converts self
into a Right
variant of Either<Self, Self>
otherwise. Read more