sp_trie

Trait TrieConfiguration

Source
pub trait TrieConfiguration: Sized + TrieLayout {
    // Provided methods
    fn trie_build<DB, I, A, B>(
        db: &mut DB,
        input: I,
    ) -> <Self::Hash as Hasher>::Out
       where DB: HashDB<Self::Hash, Vec<u8>>,
             I: IntoIterator<Item = (A, B)>,
             A: AsRef<[u8]> + Ord,
             B: AsRef<[u8]> { ... }
    fn trie_root<I, A, B>(input: I) -> <Self::Hash as Hasher>::Out
       where I: IntoIterator<Item = (A, B)>,
             A: AsRef<[u8]> + Ord,
             B: AsRef<[u8]> { ... }
    fn trie_root_unhashed<I, A, B>(input: I) -> Vec<u8> 
       where I: IntoIterator<Item = (A, B)>,
             A: AsRef<[u8]> + Ord,
             B: AsRef<[u8]> { ... }
    fn encode_index(input: u32) -> Vec<u8>  { ... }
    fn ordered_trie_root<I, A>(input: I) -> <Self::Hash as Hasher>::Out
       where I: IntoIterator<Item = A>,
             A: AsRef<[u8]> { ... }
}
Expand description

Various re-exports from the trie-db crate. This trait associates a trie definition with preferred methods. It also contains own default implementations and can be used to allow switching implementation.

Provided Methods§

Source

fn trie_build<DB, I, A, B>(db: &mut DB, input: I) -> <Self::Hash as Hasher>::Out
where DB: HashDB<Self::Hash, Vec<u8>>, I: IntoIterator<Item = (A, B)>, A: AsRef<[u8]> + Ord, B: AsRef<[u8]>,

Operation to build a trie db from its ordered iterator over its key/values.

Source

fn trie_root<I, A, B>(input: I) -> <Self::Hash as Hasher>::Out
where I: IntoIterator<Item = (A, B)>, A: AsRef<[u8]> + Ord, B: AsRef<[u8]>,

Determines a trie root given its ordered contents, closed form.

Source

fn trie_root_unhashed<I, A, B>(input: I) -> Vec<u8>
where I: IntoIterator<Item = (A, B)>, A: AsRef<[u8]> + Ord, B: AsRef<[u8]>,

Determines a trie root node’s data given its ordered contents, closed form.

Source

fn encode_index(input: u32) -> Vec<u8>

Encoding of index as a key (when reusing general trie for indexed trie).

Source

fn ordered_trie_root<I, A>(input: I) -> <Self::Hash as Hasher>::Out
where I: IntoIterator<Item = A>, A: AsRef<[u8]>,

A trie root formed from the items, with keys attached according to their compact-encoded index (using parity-codec crate).

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.

Implementors§

Source§

impl<H> TrieConfiguration for LayoutV0<H>
where H: Hasher,

Source§

impl<H> TrieConfiguration for LayoutV1<H>
where H: Hasher,