[−][src]Crate heed_types
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:
Strto storestrsUnitto store unit()typesSerdeBincodeorSerdeJsonto storeSerialize/Deserializetypes
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 types | Encoding type | Decoding type | allocations |
|---|---|---|---|
CowSlice | &[T] | Cow<[T]> | will allocate if memory is miss-aligned |
CowType | &T | Cow<T> | will allocate if memory is miss-aligned |
OwnedSlice | &[T] | Vec<T> | will always allocate |
OwnedType | &T | T | will always allocate |
UnalignedSlice | &[T] | &[T] | will never allocate because alignement is always valid |
UnalignedType | &T | &T | will never allocate because alignement is always valid |
Note that all those types above must implement AsBytes and FromBytes.
The UnalignedSlice/Type types also need to implement the Unaligned trait.
If you don't want to/cannot deal with AsBytes, Frombytes or Unaligned requirements
we recommend you to use the SerdeBincode or SerdeJson types and deal with the Serialize/Deserialize traits.
Structs
| CowSlice | Describes a slice that must be memory aligned and will be reallocated if it is not. |
| CowType | Describes a type that must be memory aligned and will be reallocated if it is not. |
| DecodeIgnore | A convenient struct made to ignore the type when decoding it. |
| OwnedSlice | Describes a |
| OwnedType | Describes a type that is totally owned (doesn't hold any reference to the original slice). |
| SerdeBincode | Describes a type that is |
| SerdeJson | Describes a type that is |
| Str | Describes an |
| UnalignedSlice | Describes a type that is totally borrowed and doesn't depends on any memory alignment. |
| UnalignedType | Describes a slice that is totally borrowed and doesn't depends on any memory alignment. |
| Unit | Describes the unit |
Type Definitions
| ByteSlice | Describes a slice of bytes |