Module bson::serde_helpers
source · Expand description
Collection of helper functions for serializing to and deserializing from BSON using Serde
Modules
- Contains functions to serialize a
crate::DateTime
as an RFC 3339 (ISO 8601) formatted string and deserialize acrate::DateTime
from an RFC 3339 (ISO 8601) formatted string. - Contains functions to serialize a
chrono::DateTime
as acrate::DateTime
and deserialize achrono::DateTime
from acrate::DateTime
. - Contains functions to serialize a hex string as an ObjectId and deserialize a hex string from an ObjectId
- Contains functions to serialize an RFC 3339 (ISO 8601) formatted string as a
crate::DateTime
and deserialize an RFC 3339 (ISO 8601) formatted string from acrate::DateTime
. - Contains functions to serialize a bson::Timestamp as a u32 and deserialize a bson::Timestamp from a u32. The u32 should represent seconds since the Unix epoch. Serialization will return an error if the Timestamp has a non-zero increment.
- Contains functions to serialize a u32 as an f64 (BSON double) and deserialize a u32 from an f64 (BSON double).
- Contains functions to serialize a u32 as a bson::Timestamp and deserialize a u32 from a bson::Timestamp. The u32 should represent seconds since the Unix epoch.
- Contains functions to serialize a u64 as an f64 (BSON double) and deserialize a u64 from an f64 (BSON double).
- Contains functions to serialize a
uuid::Uuid
as acrate::Binary
and deserialize auuid::Uuid
from acrate::Binary
. - Contains functions to serialize a
uuid::Uuid
to acrate::Binary
in the legacy C# driver UUID format and deserializeuuid::Uuid
from acrate::Binary
in the legacy C# driver format. - Contains functions to serialize a
uuid::Uuid
to acrate::Binary
in the legacy Java driver UUID format and deserializeuuid::Uuid
from acrate::Binary
in the legacy Java driver format. - Contains functions to serialize a
uuid::Uuid
to acrate::Binary
in the legacy Python driver UUID format and deserializeuuid::Uuid
from acrate::Binary
in the legacy Python driver format.
Functions
- Deserializes a
crate::DateTime
from an RFC 3339 formatted string. - Deserializes a
chrono::DateTime
from acrate::DateTime
. - Deserializes a hex string from an ObjectId.
- Deserializes a i64 integer from a DateTime.
- Deserializes an ISO string from a DateTime.
- Deserializes a bson::Timestamp from a u32.
- Deserializes a u32 from an f64 (BSON double). Errors if an exact conversion is not possible.
- Deserializes a u32 from a bson::Timestamp.
- Deserializes a u64 from an f64 (BSON double). Errors if an exact conversion is not possible.
- Deserializes a Uuid from a Binary.
- Deserializes a Uuid from a Binary in the legacy UUID format.
- Deserializes a Uuid from a Binary in the legacy UUID format.
- Deserializes a Uuid from a Binary in the legacy UUID format.
- Serializes a
crate::DateTime
as an RFC 3339 (ISO 8601) formatted string. - Serializes a
chrono::DateTime
as acrate::DateTime
. - Serializes a hex string as an ObjectId.
- Serializes a i64 integer as a DateTime.
- Serializes an
ObjectId
as a hex string. - Serializes an ISO string as a DateTime.
- Serializes a bson::Timestamp as a u32. Returns an error if the conversion is lossy (i.e. the Timestamp has a non-zero increment).
- Serializes a u32 as an f64 (BSON double).
- Attempts to serialize a u32 as an i32. Errors if an exact conversion is not possible.
- Serializes a u32 as an i64.
- Serializes a u32 as a bson::Timestamp.
- Serializes a u64 as an f64 (BSON double). Errors if an exact conversion is not possible.
- Attempts to serialize a u64 as an i32. Errors if an exact conversion is not possible.
- Attempts to serialize a u64 as an i64. Errors if an exact conversion is not possible.
- Serializes a Uuid as a Binary.
- Serializes a Uuid as a Binary in the legacy UUID format.
- Serializes a Uuid as a Binary in the legacy UUID format.
- Serializes a Uuid as a Binary in the legacy UUID format.