pub fn keys_with_prefix<'a, 'b, K, V, T, S>(
    _correlation_id: CorrelationId,
    txn: &'b T,
    store: &'a S,
    root: &Digest,
    prefix: &[u8],
) -> KeysIterator<'a, 'b, K, V, T, S>
where
    K: ToBytes + FromBytes + Clone + Eq + std::fmt::Debug,
    V: ToBytes + FromBytes + Clone + Eq + std::fmt::Debug,
    T: Readable<Handle = S::Handle>,
    S: TrieStore<K, V>,
    S::Error: From<T::Error>,
{
    let (visited, init_state): (Vec<VisitedTrieNode<K, V>>, _) = match store.get(txn, root) {
        Ok(None) => (vec![], KeysIteratorState::Ok),
        Err(e) => (vec![], KeysIteratorState::ReturnError(e)),
        Ok(Some(current_root)) => (
            vec![VisitedTrieNode {
                trie: current_root,
                maybe_index: None,
                path: vec![],
            }],
            KeysIteratorState::Ok,
        ),
    };

    KeysIterator {
        initial_descend: prefix.iter().cloned().collect(),
        visited,
        store,
        txn,
        state: init_state,
    }
}
/// Returns the iterator over the keys in the subtrie matching `prefix`.
///
/// The root should be the apex of the trie.
Returns the iterator over the keys in the subtrie matching `prefix`.
The root should be the apex of the trie.
Returns the iterator over the keys in the subtrie matching ` prefix ` . The root should be the apex of the trie .
pub fn keys_with_prefix<'a, 'b, K, V, T, S>(
    _correlation_id: CorrelationId,
    txn: &'b T,
    store: &'a S,
    root: &Digest,
    prefix: &[u8],
) -> KeysIterator<'a, 'b, K, V, T, S>
where
    K: ToBytes + FromBytes + Clone + Eq + std::fmt::Debug,
    V: ToBytes + FromBytes + Clone + Eq + std::fmt::Debug,
    T: Readable<Handle = S::Handle>,
    S: TrieStore<K, V>,
    S::Error: From<T::Error>,
{
    let (visited, init_state): (Vec<VisitedTrieNode<K, V>>, _) = match store.get(txn, root) {
        Ok(None) => (vec![], KeysIteratorState::Ok),
        Err(e) => (vec![], KeysIteratorState::ReturnError(e)),
        Ok(Some(current_root)) => (
            vec![VisitedTrieNode {
                trie: current_root,
                maybe_index: None,
                path: vec![],
            }],
            KeysIteratorState::Ok,
        ),
    };
    KeysIterator {
        initial_descend: prefix.iter().cloned().collect(),
        visited,
        store,
        txn,
        state: init_state,
    }
}
pub fn keys_with_prefix < ' a , ' b , K , V , T , S > ( _correlation_id : CorrelationId , txn : & ' b T , store : & ' a S , root : & Digest , prefix : & [ u8 ] , ) -> KeysIterator < ' a , ' b , K , V , T , S > where K : ToBytes + FromBytes + Clone + Eq + std :: fmt :: Debug , V : ToBytes + FromBytes + Clone + Eq + std :: fmt :: Debug , T : Readable < Handle = S :: Handle > , S : TrieStore < K , V > , S :: Error : From < T :: Error > , { let ( visited , init_state ) : ( Vec < VisitedTrieNode < K , V > > , _ ) = match store . get ( txn , root ) { Ok ( None ) => ( vec ! [ ] , KeysIteratorState :: Ok ) , Err ( e ) => ( vec ! [ ] , KeysIteratorState :: ReturnError ( e ) ) , Ok ( Some ( current_root ) ) => ( vec ! [ VisitedTrieNode { trie current_root maybe_index None path vec [ ] } ] , KeysIteratorState :: Ok , ) , } ; KeysIterator { initial_descend : prefix . iter ( ) . cloned ( ) . collect ( ) , visited , store , txn , state : init_state , } }
Returns the iterator over the keys in the subtrie matching `prefix`.
Returns the iterator over the keys in the subtrie matching ` prefix ` .
_correlation_id
CorrelationId
txn
&'b T
store
&'a S
root
&Digest
prefix
&[u8]
_correlation_id
CorrelationId
txn
&'b T
store
&'a S
root
&Digest
prefix
&[u8]