Crate heed_types

source ·
Expand description

Types that can be used to serialize and deserialize types inside databases.

How to choose the right type to store things in this database? For specific types you can choose:

But if you want to store big types that can be efficiently deserialized then here is a little table to help you in your quest:

Available typesEncoding typeDecoding typeallocations
CowSlice&[T]Cow<[T]>will allocate if memory is miss-aligned
CowType&TCow<T>will allocate if memory is miss-aligned
OwnedSlice&[T]Vec<T>will always allocate
OwnedType&TTwill always allocate
UnalignedSlice&[T]&[T]will never allocate because alignement is always valid
UnalignedType&T&Twill never allocate because alignement is always valid

Structs

Describes a slice that must be memory aligned and will be reallocated if it is not.
Describes a type that must be memory aligned and will be reallocated if it is not.
A convenient struct made to ignore the type when decoding it.
Describes a Vec of types that are totally owned (doesn’t hold any reference to the original slice).
Describes a type that is totally owned (doesn’t hold any reference to the original slice).
Describes a type that is Serialize/Deserialize and uses bincode to do so.
Describes a type that is Serialize/Deserialize and uses serde_json to do so.
Describes an str.
Describes a type that is totally borrowed and doesn’t depends on any memory alignment.
Describes a slice that is totally borrowed and doesn’t depends on any memory alignment.
Describes the () type.

Type Definitions

Describes a slice of bytes [u8] that is totally borrowed and doesn’t depends on any memory alignment.