Skip to main content

AsFirebaseMap

Derive Macro AsFirebaseMap 

Source
#[derive(AsFirebaseMap)]
Expand description

Implements firebae_cm::IntoFirebaseMap for a struct with named fields.

FCM data, headers and payload fields are map<string, string>, so every field is stringified via its Display implementation. Option<T> fields are omitted from the map entirely when None.

#[derive(AsFirebaseMap)]
struct MessageData {
    custom_field: String,
    another_type: i32,              // becomes "15"
    optional_field: Option<String>, // omitted when None
}