Crate alkahest[][src]

Expand description

Alkahest is serialization library aimed for packet writing and reading in hot path. For this purpose Alkahest avoids allocations and reads data only on demand.

Key differences of Alkahest from other popular serialization crates is zero-overhead serialization and zero-copy lazy deserialization.
For example to serialize value sequence it is not necessary to construct expensive type with allocations such as vectors.
Instead sequences are serialized directly from iterators. On deserialization an iterator is returned to the user, which does not parse any element before it is requested. Which means that data that is not accessed - not parsed either.

Alkahest works similarly to FlatBuffers,
but does not require using another language for data scheme definition and running external tool,
and supports generic schemas.


Unpacked array. Generated by reading using Seq schema.


Schema for runtime sized bytes array. Should be used for bytes and strings alike.

Schema for runtime sized sequence of T.

Schema for runtime sized bytes array. Should be used for bytes and strings alike.


Trait for packable types that match specified Schema.

Trait for data schemas.

The purpose of this trait is to define associated type for each lifetime for Schema trait implementations. This is a workaround for lack of HRTB support for associated types.


Reads and unpacks package from raw bytes.

Writes data into bytes slice. Returns number of bytes written.

Type Definitions

Type alias for packed value with Schema of type T.

Type alias for unpacked value with Schema of type T.