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§
- base64
 - Transparent base64 encoding / decoding as part of (de)serialization.
 - can_
be_ empty  - Helpers for emptiness checks in 
#[serde(skip_serializing_if)]. - duration
 - De-/serialization functions for 
std::time::Durationobjects - json_
string  - De-/serialization functions to and from json strings, allows the type to be used as a query string.
 - single_
element_ seq  - De-/serialization functions to and from single element sequences.
 - test
 - Helpers for tests
 
Structs§
- Base64
 - A wrapper around 
B(usuallyVec<u8>) that (de)serializes from / to a base64 string. - Base64
Decode Error  - An error that occurred while decoding a base64 string.
 - Raw
 - A wrapper around 
Box<RawValue>with a generic parameter for the expected Rust type. 
Traits§
- CanBe
Empty  - Trait for types that have an “empty” state.
 - Json
Castable  - Marker trait for restricting the types 
Raw::deserialize_as,Raw::castandRaw::cast_refcan be called with. 
Functions§
- btreemap_
deserialize_ v1_ powerlevel_ values  - Take a BTreeMap with values of either an integer number or a string and deserialize those to integer numbers.
 - default_
on_ error  - Helper function for returning a default value if deserialization of the type fails.
 - default_
true  - Simply returns 
true. - deserialize_
as_ number_ or_ string  - Take either a floating point number or a string and deserialize to an floating-point number.
 - deserialize_
as_ optional_ number_ or_ string  - Deserializes an 
Option<f64>from an encoded f64 or string or integer (i64 or u64). - deserialize_
cow_ str  - Deserialize a 
Cow<'de, str>. - deserialize_
v1_ powerlevel  - Take either an integer number or a string and deserialize to an integer number.
 - empty_
string_ as_ none  - Serde deserialization decorator to map empty Strings to None, and forward non-empty Strings to the Deserialize implementation for T.
 - from_
raw_ json_ value  - Helper function for 
serde_json::value::RawValuedeserialization. - ignore_
invalid_ vec_ items  - Helper function for ignoring invalid items in a 
Vec, instead letting them cause the entireVecto fail deserialization - is_
default  - Check whether a value is equal to its default value.
 - is_
empty  - Check whether a value is empty.
 - is_true
 - Simply dereferences the given bool.
 - json_
to_ buf  - Creates a buffer and writes a serializable value to it.
 - none_
as_ default  - Deserialize a 
TviaOption<T>, falling back toT::default(). - none_
as_ empty_ string  - Serde serializiation decorator to map 
Noneto an emptyString, and forwardSomes to theSerializeimplementation forT. - slice_
to_ buf  - Converts a byte slice to a buffer by copying.
 
Type Aliases§
- Json
Object  - The inner type of 
JsonValue::Object. 
Derive Macros§
- AsRef
Str  - Derive the 
AsRef<str>trait for an enum. - AsStr
AsRef Str  - Derive the 
as_str()method using theAsRef<str>implementation of the type. - Debug
AsRef Str  - Derive the 
fmt::Debugtrait using theAsRef<str>implementation of the type. - Deserialize
From CowStr  - Derive the 
Deserializetrait using theFrom<Cow<str>>implementation of the type. - Display
AsRef Str  - Derive the 
fmt::Displaytrait using theAsRef<str>implementation of the type. - EqAs
RefStr  - Derive the 
PartialEqandEqtraits using theAsRef<str>implementation of the type. - From
String  - Derive the 
From<T: AsRef<str> + Into<Box<str>>>trait for an enum. - OrdAs
RefStr  - Derive the 
OrdandPartialOrdtraits using theAsRef<str>implementation of the type. - Serialize
AsRef Str  - Derive the 
Serializetrait using theAsRef<str>implementation of the type. - String
Enum  - Shorthand for the derives 
AsRefStr,FromString,DisplayAsRefStr,DebugAsRefStr,SerializeAsRefStr,DeserializeFromCowStr,EqAsRefStrandOrdAsRefStr.