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
.
Re-exports§
pub use self::base64::Base64;
pub use self::base64::Base64DecodeError;
pub use self::can_be_empty::is_empty;
pub use self::can_be_empty::CanBeEmpty;
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
Box<RawValue>
with a generic parameter for the expected Rust type.
Functions§
- Take a BTreeMap with values of either an integer number or a string and deserialize those to integer numbers.
- Simply returns
true
. - Take either a floating point number or a string and deserialize to an floating-point number.
- Deserializes an
Option<f64>
from an encoded f64 or string or integer (i64 or u64). - Deserialize a
Cow<'de, str>
. - Take either an integer number or a string and deserialize to an integer number.
- Serde deserialization decorator to map empty Strings to None, and forward non-empty Strings to the Deserialize implementation for T.
- Helper function for
serde_json::value::RawValue
deserialization. - Check whether a value is equal to its default value.
- Simply dereferences the given bool.
- Creates a buffer and writes a serializable value to it.
- Deserialize a
T
viaOption<T>
, falling back toT::default()
. - Serde serializiation decorator to map
None
to an emptyString
, and forwardSome
s to theSerialize
implementation forT
. - Converts a byte slice to a buffer by copying.
Type Aliases§
- The inner type of
JsonValue::Object
.
Derive Macros§
- Derive the
AsRef<str>
trait for an enum. - Derive the
as_str()
method using theAsRef<str>
implementation of the type. - Derive the
fmt::Debug
trait using theAsRef<str>
implementation of the type. - Derive the
Deserialize
trait using theFrom<Cow<str>>
implementation of the type. - Derive the
fmt::Display
trait using theAsRef<str>
implementation of the type. - Derive the
From<T: AsRef<str> + Into<Box<str>>>
trait for an enum. - Derive the
Ord
trait using theAsRef<str>
implementation of the type. - Derive the
PartialEq
trait using theAsRef<str>
implementation of the type. - Derive the
PartialOrd
trait using theAsRef<str>
implementation of the type. - Derive the
Serialize
trait using theAsRef<str>
implementation of the type. - Shorthand for the derives
AsRefStr
,FromString
,DisplayAsRefStr
,DebugAsRefStr
,SerializeAsRefStr
andDeserializeFromCowStr
.