Crate neodyn_xc[−][src]
Neodyn Exchange defines the interchange (serialization) format for Neodyn DB.
Caveats
Neodyn Exchange has three, more or less equivalent representations:
- An in-memory tree represented by the
Value
type and the corresponding serializer and deserializer; - A human-readable text format defined by the appropriate serializer and deserializer;
- And a compact, efficient, machine-readable binary format, defined by its own serializer and deserializer.
A best effort is made to bring (and keep) the semantics of these three formats as close as possible. In particular, the formats are supposed to be able to represent the same set of values. However, as usual, care must be taken when serializing a value into one of the human-readable formats and deserializing it from the compact binary format, or vice versa.
Neodyn Exchange is a 64-bit format. 128-bit integers are supported as long as their value dynamically fits into the 64-bit type of the same signedness.
Floating-point values that represent a NaN
will be serialized as null
,
but null
will not deserialize as NaN
. This is in line with the behavior
of serde_json
. Serializing NaN
is discouraged anyway – it is a weird
artefact of the past, and we should not be using it, since Rust has proper
optionals in the type system.
Crate Features
quickcheck
: providesimpl Arbitrary for Value
. Required for running tests: usecargo test --release --features quickcheck
.serde_json
: provides conversions (From
andTryFrom
) betweenneodyn_xc::Value
andserde_json::Value
.chrono
: providesimpl From<DateTime> for Value
.uuid
: providesimpl From<Uuid> for Value
.full
: enable all of the above features.
Re-exports
pub use crate::value::Value; |
pub use crate::ser::value::to_value; |
pub use crate::ser::text::to_string; |
pub use crate::ser::binary::to_bytes; |
pub use crate::ser::binary::to_writer; |
pub use crate::ser::binary::to_writer_buffered; |
pub use crate::de::value::from_value; |
pub use crate::de::value_ref::from_value_ref; |
pub use crate::de::text::from_str; |
pub use crate::de::binary::from_bytes; |
pub use crate::de::binary::from_reader; |
pub use crate::de::binary::from_reader_buffered; |
Modules
de | Umbrella module for deserializing the exchange format from human-readable text, a compact binary format, or an in-memory value tree. |
error | Common |
format | This module codifies the bit-level details of the binary format. |
ser | Umbrella module for serializing the exchange format as human-readable text, a compact binary format, or an in-memory value tree. |
span | Manipulating source locations. |
value | In-memory, structured representation of a Neodyn Exchange value tree. |