pub trait StateCodec {
type KeyCodec;
type ValueCodec;
// Required methods
fn key_codec(&self) -> &Self::KeyCodec;
fn value_codec(&self) -> &Self::ValueCodec;
}
Expand description
A trait for types that can serialize keys and values, as well as deserializing values for storage access.
§Type bounds
There are no type bounds on StateCodec::KeyCodec
and
StateCodec::ValueCodec
, so they can be any type at well. That said,
you’ll find many APIs require these two to implement StateKeyCodec
and
StateValueCodec
respectively.
Required Associated Types§
Sourcetype KeyCodec
type KeyCodec
The codec used to serialize keys. See StateKeyCodec
.
Sourcetype ValueCodec
type ValueCodec
The codec used to serialize and deserialize values. See
StateValueCodec
.
Required Methods§
Sourcefn value_codec(&self) -> &Self::ValueCodec
fn value_codec(&self) -> &Self::ValueCodec
Returns a reference to the type’s value codec.