Skip to main content

deserialize_raw_object

Function deserialize_raw_object 

Source
pub fn deserialize_raw_object<'de, T, D>(
    deserializer: D,
) -> Result<Raw<T>, <D as Deserializer<'de>>::Error>
where D: Deserializer<'de>,
Expand description

Deserialize a Raw<T> and reject any value whose top-level JSON shape is not an object.

Use as #[serde(deserialize_with = "ruma_common::serde::deserialize_raw_object")] wherever the Matrix spec mandates an object (e.g., Raw<EventContent> on the body of /_matrix/client/.../send endpoints, or on inner fields, response fields, etc.).