ruma::serde

Function deserialize_as_number_or_string

Source
pub fn deserialize_as_number_or_string<'de, D>(
    de: D,
) -> Result<f64, <D as Deserializer<'de>>::Error>
where D: Deserializer<'de>,
Expand description

Take either a floating point number or a string and deserialize to an floating-point number.

To be used like this: #[serde(deserialize_with = "deserialize_as_number_or_string")]