Expand description
This module contains types and functions for manual implementations of
Serialize
and Deserialize
traits.
Structs
- Fixed buffer without bound checks. If buffer is too small to fit serialized data, it will panic.
- Deserializer from raw bytes. Provides methods for deserialization of values.
- Type used to represent sizes and offsets in serialized data. This places limitation on sequence sizes which practically is never hit.
usize
itself is not portable and cannot be written into alkahest package. - Buffer that writes to a slice. If buffer is too small to fit serialized data it keeps pretends to work and tracks the size of the values that would be written. Returns
BufferSizeRequired
error if serialized data is too big. - Heap and stack sizes.
- Writes elements of a slice one by one into associated buffer.
- Extensible buffer that writes to a vector. If buffer is too small to fit serialized data it extends the vector. Never returns an error, cannot fail to serialize data except for OOM error.
Traits
- Ad-hoc negative trait. It should be implemented for most formulas. Except for formulas with generic implementation of
Serialize
andDeserialize
traits via anotherFormula
. - Buffer API that is used by serializer. Buffers can be extensible or fixed size. Extensible buffers grow automatically when needed.
Functions
- Returns the size of the serialized data if it can be determined fast.
- Deserialize into
Extend
value from slice formula. - Deserialize
FromIterator
value from slice formula. - Size hint for serializing a field.
- Returns size hint for the formula if it is known at compile time.
- Returns size of formula reference.
- Returns a writer to write elements of a slice one by one into associated buffer.
- Writes array into buffer.
- Write raw bytes to the buffer.
- Write a field with exact size into buffer. Requires that
F::EXACT_SIZE
istrue
andF::MAX_STACK_SIZE
isSome
. - Writes field value into the buffer.
- Write value to the buffer as a reference, placing value into the heap and reference into the stack.
- Writes reference into the buffer.
- Writes iterator into buffer.
Type Definitions
- Type used to represent sizes and offsets in serialized data.