Expand description
Common serialization traits and functions.
This module provides custom serde deserializers and serializers for common patterns encountered when parsing exchange API responses, particularly:
- Empty strings that should be interpreted as
Noneor zero. - Type conversions from strings to primitives.
- Decimal values represented as strings.
Re-exports§
pub use self::msgpack::FromMsgPack;pub use self::msgpack::MsgPackSerializable;pub use self::msgpack::ToMsgPack;
Modules§
- msgpack
- Provides MsgPack serialization support for types implementing
Serializable.
Traits§
- Serializable
- Represents types which are serializable for JSON specifications.
Functions§
- default_
false - Serde default value function that returns
false. - default_
true - Serde default value function that returns
true. - deserialize_
decimal_ from_ str - Deserializes a
Decimalfrom a JSON string. - deserialize_
decimal_ or_ zero - Deserializes a
Decimalfrom a string field that might be empty. - deserialize_
empty_ string_ as_ none - Deserializes an empty string into
None. - deserialize_
empty_ ustr_ as_ none - Deserializes an empty [
Ustr] intoNone. - deserialize_
optional_ decimal - Deserializes an optional
Decimalfrom a string field. - deserialize_
optional_ decimal_ from_ str - Deserializes an optional
Decimalfrom a string-only field. - deserialize_
optional_ decimal_ or_ zero - Deserializes a
Decimalfrom an optional string field, defaulting to zero. - deserialize_
optional_ string_ to_ u64 - Deserializes an optional
u64from a string field. - deserialize_
string_ to_ u8 - Deserializes a
u8from a string field. - deserialize_
string_ to_ u64 - Deserializes a
u64from a string field. - deserialize_
vec_ decimal_ from_ str - Deserializes a
Vec<Decimal>from a JSON array of strings. - from_
bool_ as_ u8 - Deserialize the boolean value as a
u8. - parse_
decimal - Parses a string to
Decimal, returning an error if parsing fails. - parse_
optional_ decimal - Parses an optional string to
Decimal, returningNoneif the string isNoneor empty. - serialize_
decimal_ as_ str - Serializes a
Decimalas a string (lossless, no scientific notation). - serialize_
optional_ decimal_ as_ str - Serializes an optional
Decimalas a string. - serialize_
vec_ decimal_ as_ str - Serializes a
Vec<Decimal>as an array of strings.