Module lmdb_rs::traits [] [src]

Conversion of data structures to and from MDB_val

Since MDB_val is valid through whole transaction, it is kind of safe to keep plain data, i.e. to keep raw pointers and transmute them back and forward into corresponding data structures to avoid any unnecessary copying.

MdbValue is a simple wrapper with bounded lifetime which should help keep it sane, i.e. provide compile errors when data retrieved outlives transaction.

It would be extremely helpful to create compile-fail tests to ensure this, but unfortunately there is no way yet.

Traits

FromMdbValue

FromMdbValue is supposed to reconstruct a value from memory slice. It allows to use zero copy where it is required.

ToMdbValue

ToMdbValue is supposed to convert a value to a memory slice which lmdb uses to prevent multiple copying data multiple times. May be unsafe.