Trait mmtkvdb::storable::StorableRef
source · [−]pub unsafe trait StorableRef<'a, T> where
Self: Sized + Copy,
T: ?Sized + Storable + 'a, {
fn ref_to_bytes(self) -> T::BytesRef<'a>;
fn ref_bytes_len(self) -> usize { ... }
}
Expand description
Reference-like types which can be used to store a Storable
type
Type parameter T
is the Storable
type and 'a
is the lifetime used for
the reference-like type.
For example, (&'a i32, &'a str)
implements
StorableRef<'a, (i32, String)>
and may thus be passed to
TxnRw::put
instead of &'a (i32, String)
.
This avoids unnecessary cloning when constructing the tuple.
Required Methods
fn ref_to_bytes(self) -> T::BytesRef<'a>
fn ref_to_bytes(self) -> T::BytesRef<'a>
Converts reference to byte slice
Provided Methods
fn ref_bytes_len(self) -> usize
fn ref_bytes_len(self) -> usize
Length of byte representation