Query

Trait Query 

Source
pub trait Query<H: Hasher> {
    type Item;

    // Required method
    fn decode(self, data: &[u8]) -> Self::Item;

    // Provided method
    fn record(&mut self, _hash: &H::Out, _data: &[u8], _depth: u32) { ... }
}
Expand description

Description of what kind of query will be made to the trie.

This is implemented for any &mut recorder (where the query will return a DBValue), any function taking raw bytes (where no recording will be made), or any tuple of (&mut Recorder, FnOnce(&u8))

Required Associated Types§

Source

type Item

Output item.

Required Methods§

Source

fn decode(self, data: &[u8]) -> Self::Item

Decode a byte-slice into the desired item.

Provided Methods§

Source

fn record(&mut self, _hash: &H::Out, _data: &[u8], _depth: u32)

Record that a node has been passed through.

Implementations on Foreign Types§

Source§

impl<'a, F, T, H: Hasher> Query<H> for (&'a mut Recorder<H::Out>, F)
where F: FnOnce(&[u8]) -> T,

Source§

type Item = T

Source§

fn decode(self, value: &[u8]) -> T

Source§

fn record(&mut self, hash: &H::Out, data: &[u8], depth: u32)

Implementors§

Source§

impl<'a, H: Hasher> Query<H> for &'a mut Recorder<H::Out>

Source§

impl<F, T, H: Hasher> Query<H> for F
where F: for<'a> FnOnce(&'a [u8]) -> T,

Source§

type Item = T