pub struct FcmSettings {
pub min_ttl: u64,
pub server_credentials: String,
pub max_data: usize,
pub base_url: Url,
pub timeout: usize,
pub max_ttl: i64,
}Expand description
Settings for FcmRouter
Fields§
§min_ttl: u64The minimum TTL to use for FCM notifications
server_credentials: StringA JSON dict of FcmCredentials. 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: usizeThe max size of notification data in bytes
base_url: UrlThe base URL to use for FCM requests
timeout: usizeThe number of seconds to wait for FCM requests to complete
max_ttl: i64The max TTL for a FCM notification.
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 UnsafeUnpin 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,
§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