pub trait AsLmdbBytes {
    fn as_lmdb_bytes(&self) -> &[u8]Notable traits for &'_ [u8]impl<'_> Read for &'_ [u8]impl<'_> Write for &'_ mut [u8];
}
Expand description

Translates a value into a byte slice to be stored in LMDB.

This is similar to AsRef<[u8]>, but is separate since there are things one may wish to store in LMDB but not have implicitly coerce to &[u8] in other contexts.

Blanket impls are provided for LmdbRaw and for slices of LmdbRaw values. Ideally there’d be one for anything AsRef<[u8]>, but in Rust 1.10 that’s not possible due to coherence rules barring having blanket implementations for both LmdbRaw and AsRef<[u8]>, so currently it is provided only for &str and &Vec<u8>.

This is not a general-purpose serialisation mechanism. There is no way to use this trait to store values in a format other than how they are natively represented in memory. Doing this requires serialisation into a byte array before passing it onto lmdb-zero.

Required methods

Casts the given reference to a byte slice appropriate for storage in LMDB.

Implementations on Foreign Types

Returns the raw content of the CStr, including the trailing NUL.

Implementors