ruma

Module serde

Source
Expand description

(De)serialization helpers for other Ruma crates.

Part of that is a fork of serde_urlencoded, with support for sequences in Deserialize / Serialize structs (e.g. Vec<Something>) that are (de)serialized as field=val1&field=val2.

Modules§

  • Transparent base64 encoding / decoding as part of (de)serialization.
  • Helpers for emptiness checks in #[serde(skip_serializing_if)].
  • De-/serialization functions for std::time::Duration objects
  • De-/serialization functions to and from json strings, allows the type to be used as a query string.
  • De-/serialization functions to and from single element sequences.
  • Helpers for tests

Structs§

  • A wrapper around B (usually Vec<u8>) that (de)serializes from / to a base64 string.
  • An error that occurred while decoding a base64 string.
  • A wrapper around Box<RawValue> with a generic parameter for the expected Rust type.

Traits§

  • Trait for types that have an “empty” state.

Functions§

Type Aliases§

Derive Macros§

  • Derive the AsRef<str> trait for an enum.
  • Derive the as_str() method using the AsRef<str> implementation of the type.
  • Derive the fmt::Debug trait using the AsRef<str> implementation of the type.
  • Derive the Deserialize trait using the From<Cow<str>> implementation of the type.
  • Derive the fmt::Display trait using the AsRef<str> implementation of the type.
  • Derive the From<T: AsRef<str> + Into<Box<str>>> trait for an enum.
  • Derive the Ord trait using the AsRef<str> implementation of the type.
  • Derive the PartialEq trait using the AsRef<str> implementation of the type.
  • Derive the PartialOrd trait using the AsRef<str> implementation of the type.
  • Derive the Serialize trait using the AsRef<str> implementation of the type.
  • Shorthand for the derives AsRefStr, FromString, DisplayAsRefStr, DebugAsRefStr, SerializeAsRefStr and DeserializeFromCowStr.