pub trait Config {
type Key;
type Value;
type EncodedKey: ByteArray;
type EncodedValue: ByteArray;
type H: HashFn;
// Required methods
fn encode_key(k: &Self::Key) -> Self::EncodedKey;
fn encode_value(v: &Self::Value) -> Self::EncodedValue;
fn decode_key(k: &Self::EncodedKey) -> Self::Key;
fn decode_value(v: &Self::EncodedValue) -> Self::Value;
}Expand description
This trait provides a complete “configuration” for a hash table, i.e. it defines the key and value types, how these are encoded and what hash function is being used.
Implementations of the encode_key and encode_value methods must encode
the given key/value into a fixed size array. The encoding must be
deterministic (i.e. no random padding bytes) and must be independent of
platform endianess. It is always highly recommended to mark these methods
as #[inline].
Required Associated Types§
type Key
type Value
type EncodedKey: ByteArray
type EncodedValue: ByteArray
type H: HashFn
Required Methods§
Sourcefn encode_key(k: &Self::Key) -> Self::EncodedKey
fn encode_key(k: &Self::Key) -> Self::EncodedKey
Implementations of the encode_key and encode_value methods must encode
the given key/value into a fixed size array. See above for requirements.
Sourcefn encode_value(v: &Self::Value) -> Self::EncodedValue
fn encode_value(v: &Self::Value) -> Self::EncodedValue
Implementations of the encode_key and encode_value methods must encode
the given key/value into a fixed size array. See above for requirements.
fn decode_key(k: &Self::EncodedKey) -> Self::Key
fn decode_value(v: &Self::EncodedValue) -> Self::Value
Dyn Compatibility§
This trait is not dyn compatible.
In older versions of Rust, dyn compatibility was called "object safety".