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:
- [
Str
] to storestr
s - [
Unit
] to store()
types - [
SerdeBincode
] or [SerdeJson
] to storeSerialize
/Deserialize
types
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 |