Crate peek_poke

Source
Expand description

Fast binary serialization and deserialization for types with a known maximum size.

Β§Binary Encoding Scheme

Β§Usage

Β§Comparison to bincode

ModulesΒ§

euclid πŸ”’
slice_ext πŸ”’
vec_ext πŸ”’

MacrosΒ§

impl_for_arrays πŸ”’
impl_for_primitive πŸ”’
impl_for_tuple πŸ”’
impl_poke_for_deref πŸ”’

TraitsΒ§

Peek
A trait for values that provide deserialization from buffers of bytes.
Poke
A trait for values that provide serialization into buffers of bytes.

FunctionsΒ§

ensure_red_zone
Add T::max_size() β€œred zone” (padding of zeroes) to the end of the vec of bytes. This allows deserialization to assert that at least T::max_size() bytes exist at all times.
peek_from_default⚠
Peek helper for constructing a T by Default initialized stack allocation.
peek_from_slice
Peek inplace a T from a slice of bytes, returning a slice of the remaining bytes. src must contain at least T::max_size() bytes.
peek_from_uninit⚠
Peek helper for constructing a T by Copying into an uninitialized stack allocation.
poke_extend_vec
poke_inplace_slice
Poke helper to insert a serialized version of src at the beginning for dst.
poke_into_vec
Poke helper to append a serialized version of src to the end of dst.
read_verbatim πŸ”’ ⚠
strip_red_zone
Remove the β€œred zone” (padding of zeroes) from the end of the vec of bytes. This is effectively the inverse of ensure_red_zone, with the caveat that space reserved for the red zone is not un-reserved. Callers are repsonsible for making sure the vec actually has a red zone, otherwise data bytes can get stripped instead.
write_verbatim πŸ”’ ⚠

UnionsΒ§

MaybeUninitShim πŸ”’

Derive MacrosΒ§

PeekPoke