pub struct FcmSettings {
pub min_ttl: u64,
pub server_credentials: String,
pub max_data: usize,
pub base_url: Url,
pub timeout: usize,
}
Expand description
Settings for FcmRouter
Fields§
§min_ttl: u64
The minimum TTL to use for FCM notifications
server_credentials: String
A JSON dict of FcmCredential
s. This must be a String
because
environment variables cannot encode a HashMap<String, FcmCredential>
This contains both GCM and FCM credentials.
FCM (the more modern credential set) is specified as
{"_project_id_":{"project_id": "_project_id_", "credential": "_key_"}, ...}
For FCM, credential
keys can be either a serialized JSON string, or the
path to the JSON key file.
GCM follows the same pattern, where
_project_id_
== senderID and _key_
== credential
e.g. “bar-project” is via FCM, with a serialized JSON key,
e.g. “gorp-project” is via FCM, with a key path,
and a GCM project with SenderID of “f00” specifies the server key as credential
{"bar-project":{"project_id": "bar-project-1234", "credential": "{\"type\": ...}"},
"gorp-project":{"project_id": "gorp-project-abcd", "credential": "keys/gorp-project.json"},
"f00": {"project_id": "f00", "credential": "abcd0123457"},
...
}
max_data: usize
The max size of notification data in bytes
base_url: Url
The base URL to use for FCM requests
timeout: usize
The number of seconds to wait for FCM requests to complete
Implementations§
source§impl FcmSettings
impl FcmSettings
sourcepub fn credentials(&self) -> Result<HashMap<String, FcmServerCredential>>
pub fn credentials(&self) -> Result<HashMap<String, FcmServerCredential>>
Read the credentials from the provided JSON
Trait Implementations§
source§impl Clone for FcmSettings
impl Clone for FcmSettings
source§fn clone(&self) -> FcmSettings
fn clone(&self) -> FcmSettings
1.0.0 · source§fn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
source
. Read moresource§impl Debug for FcmSettings
impl Debug for FcmSettings
source§impl Default for FcmSettings
impl Default for FcmSettings
source§impl<'de> Deserialize<'de> for FcmSettingswhere
FcmSettings: Default,
impl<'de> Deserialize<'de> for FcmSettingswhere
FcmSettings: Default,
source§fn deserialize<__D>(__deserializer: __D) -> Result<Self, __D::Error>where
__D: Deserializer<'de>,
fn deserialize<__D>(__deserializer: __D) -> Result<Self, __D::Error>where
__D: Deserializer<'de>,
Auto Trait Implementations§
impl Freeze for FcmSettings
impl RefUnwindSafe for FcmSettings
impl Send for FcmSettings
impl Sync for FcmSettings
impl Unpin for FcmSettings
impl UnwindSafe for FcmSettings
Blanket Implementations§
§impl<T> AnySync for T
impl<T> AnySync for T
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§unsafe fn clone_to_uninit(&self, dst: *mut T)
unsafe fn clone_to_uninit(&self, dst: *mut T)
clone_to_uninit
)§impl<T> Instrument for T
impl<T> Instrument for T
§fn instrument(self, span: Span) -> Instrumented<Self>
fn instrument(self, span: Span) -> Instrumented<Self>
§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>
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>
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