pub struct WebpushConfig { /* private fields */ }
Expand description
Represents all settings for web. See https://firebase.google.com/docs/reference/fcm/rest/v1/projects.messages#webpushconfig.
Implementations§
Source§impl WebpushConfig
impl WebpushConfig
pub fn new() -> Self
Sourcepub fn headers(
&mut self,
headers: impl IntoFirebaseMap,
) -> Result<&mut Self, Error>
pub fn headers( &mut self, headers: impl IntoFirebaseMap, ) -> Result<&mut Self, Error>
Set the headers field. Accepts any type that implements IntoFirebaseMap, which will construct the required Map<String, String>.
For ease, you can use the crate::AsFirebaseMap derive macro on your structs:
use firebae_cm::{AsFirebaseMap, WebpushConfig};
#[derive(AsFirebaseMap)]
struct WebHeaders {
field1: String,
field2: String,
}
fn main() {
let headers = WebHeaders {
field1: "Hello,".to_string(),
field2: "world!".to_string(),
};
let mut config = WebpushConfig::new();
config.headers(headers).expect("Data not parsable");
}
Sourcepub fn data(&mut self, data: impl IntoFirebaseMap) -> Result<&mut Self, Error>
pub fn data(&mut self, data: impl IntoFirebaseMap) -> Result<&mut Self, Error>
Set the data field. Accepts any type that implements IntoFirebaseMap, which will construct the required Map<String, String>.
For ease, you can use the crate::AsFirebaseMap derive macro on your structs:
use firebae_cm::{AsFirebaseMap, WebpushConfig};
#[derive(AsFirebaseMap)]
struct WebData {
field1: String,
field2: String,
}
fn main() {
let data = WebData {
field1: "Hello,".to_string(),
field2: "world!".to_string(),
};
let mut config = WebpushConfig::new();
config.data(data).expect("Data not parsable");
}
Sourcepub fn notification(
&mut self,
notification: impl Serialize,
) -> Result<&mut Self, Error>
pub fn notification( &mut self, notification: impl Serialize, ) -> Result<&mut Self, Error>
Set the notification field. Accepts any type that implements Serialize.
pub fn fcm_options(&mut self, fcm_options: WebpushFcmOptions) -> &mut Self
Trait Implementations§
Source§impl Clone for WebpushConfig
impl Clone for WebpushConfig
Source§fn clone(&self) -> WebpushConfig
fn clone(&self) -> WebpushConfig
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 WebpushConfig
impl Debug for WebpushConfig
Source§impl Default for WebpushConfig
impl Default for WebpushConfig
Source§fn default() -> WebpushConfig
fn default() -> WebpushConfig
Returns the “default value” for a type. Read more
Auto Trait Implementations§
impl Freeze for WebpushConfig
impl RefUnwindSafe for WebpushConfig
impl Send for WebpushConfig
impl Sync for WebpushConfig
impl Unpin for WebpushConfig
impl UnwindSafe for WebpushConfig
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