Module serialization

Module serialization 

Source
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 None or 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 Decimal from a JSON string.
deserialize_decimal_or_zero
Deserializes a Decimal from 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] into None.
deserialize_optional_decimal
Deserializes an optional Decimal from a string field.
deserialize_optional_decimal_from_str
Deserializes an optional Decimal from a string-only field.
deserialize_optional_decimal_or_zero
Deserializes a Decimal from an optional string field, defaulting to zero.
deserialize_optional_string_to_u64
Deserializes an optional u64 from a string field.
deserialize_string_to_u8
Deserializes a u8 from a string field.
deserialize_string_to_u64
Deserializes a u64 from 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, returning None if the string is None or empty.
serialize_decimal_as_str
Serializes a Decimal as a string (lossless, no scientific notation).
serialize_optional_decimal_as_str
Serializes an optional Decimal as a string.
serialize_vec_decimal_as_str
Serializes a Vec<Decimal> as an array of strings.