pub trait TrieKeyAdapter:
Clone
+ Send
+ Sync
+ 'static {
type AccountKey: Key + From<Nibbles> + Clone;
type StorageSubKey: Key + From<Nibbles> + Clone + PartialEq;
type StorageValue: Value + StorageTrieEntryLike<SubKey = Self::StorageSubKey>;
// Required methods
fn account_key_to_nibbles(key: &Self::AccountKey) -> Nibbles;
fn subkey_to_nibbles(subkey: &Self::StorageSubKey) -> Nibbles;
}trie and trie-db only.Expand description
Trait abstracting nibble encoding for trie keys.
Allows the same cursor implementation to work with both legacy (65-byte) and
packed (33-byte) nibble encodings. The underlying cursor types are monomorphized per
adapter, while DatabaseTrieCursorFactory selects the encoding at runtime.
Required Associated Types§
Sourcetype AccountKey: Key + From<Nibbles> + Clone
type AccountKey: Key + From<Nibbles> + Clone
The key type for account trie lookups (e.g., StoredNibbles or PackedStoredNibbles).
Sourcetype StorageSubKey: Key + From<Nibbles> + Clone + PartialEq
type StorageSubKey: Key + From<Nibbles> + Clone + PartialEq
The subkey type for storage trie DupSort lookups
(e.g., StoredNibblesSubKey or PackedStoredNibblesSubKey).
Sourcetype StorageValue: Value + StorageTrieEntryLike<SubKey = Self::StorageSubKey>
type StorageValue: Value + StorageTrieEntryLike<SubKey = Self::StorageSubKey>
The storage trie entry type that pairs a subkey with a BranchNodeCompact.
Required Methods§
Sourcefn account_key_to_nibbles(key: &Self::AccountKey) -> Nibbles
fn account_key_to_nibbles(key: &Self::AccountKey) -> Nibbles
Convert an account key back to Nibbles.
Sourcefn subkey_to_nibbles(subkey: &Self::StorageSubKey) -> Nibbles
fn subkey_to_nibbles(subkey: &Self::StorageSubKey) -> Nibbles
Convert a storage subkey back to Nibbles.
Dyn Compatibility§
This trait is not dyn compatible.
In older versions of Rust, dyn compatibility was called "object safety", so this trait is not object safe.