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::Duration
objects - 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.
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_
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::RawValue
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
T
viaOption<T>
, falling back toT::default()
. - none_
as_ empty_ string - Serde serializiation decorator to map
None
to an emptyString
, and forwardSome
s to theSerialize
implementation 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::Debug
trait using theAsRef<str>
implementation of the type. - Deserialize
From CowStr - Derive the
Deserialize
trait using theFrom<Cow<str>>
implementation of the type. - Display
AsRef Str - Derive the
fmt::Display
trait 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
Ord
trait using theAsRef<str>
implementation of the type. - Partial
EqAs RefStr - Derive the
PartialEq
trait using theAsRef<str>
implementation of the type. - Partial
OrdAs RefStr - Derive the
PartialOrd
trait using theAsRef<str>
implementation of the type. - Serialize
AsRef Str - Derive the
Serialize
trait using theAsRef<str>
implementation of the type. - String
Enum - Shorthand for the derives
AsRefStr
,FromString
,DisplayAsRefStr
,DebugAsRefStr
,SerializeAsRefStr
andDeserializeFromCowStr
.