[][src]Module ordcode::primitives

Ordered serialization/deserialization for primitive types and byte arrays.

If you need to serialize or deserialize a primitive type (e.g. for use as a key), it is better to use SerializableValue trait methods on primitive types directly, without using serde.

Serialize method to_write() writes results to WriteBytes trait impl, deserialize method from_reader() reads from ReadBytes.

Deserializing a value which was serialized for different EncodingParams is unchecked and is undefined behaviour!

Note that u128 and i128 may not be supported on some platforms.

Encoding details

  • unsigned integers are encoded in big-endian layout
  • integers are encoded min-value-complemented, big-endian layout

Parameters

Encoding parameters are passed via impl of EncodingParams (usually ZST struct).

Constants

VERSION

Serialization data format version

Traits

SerializableValue

Serializable value

Functions

invert_buffer

Bitwise invert contents of a buffer