|
|
@ -139,8 +139,8 @@ impl<T: AsRef<MapData>, K: Pod, V: Pod> LpmTrie<T, K, V> {
|
|
|
|
|
|
|
|
|
|
|
|
/// An iterator visiting all keys matching key. The
|
|
|
|
/// An iterator visiting all keys matching key. The
|
|
|
|
/// iterator item type is `Result<Key<K>, MapError>`.
|
|
|
|
/// iterator item type is `Result<Key<K>, MapError>`.
|
|
|
|
pub fn iter_key(&self, key: Key<K>) -> LpnTrieKeys<'_, K> {
|
|
|
|
pub fn iter_key(&self, key: Key<K>) -> LpmTrieKeys<'_, K> {
|
|
|
|
LpnTrieKeys::new(self.inner.as_ref(), key)
|
|
|
|
LpmTrieKeys::new(self.inner.as_ref(), key)
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
@ -188,15 +188,15 @@ impl<T: AsRef<MapData>, K: Pod, V: Pod> IterableMap<Key<K>, V> for LpmTrie<T, K,
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
/// Iterator returned by `LpmTrie::iter_key()`.
|
|
|
|
/// Iterator returned by `LpmTrie::iter_key()`.
|
|
|
|
pub struct LpnTrieKeys<'coll, K: Pod> {
|
|
|
|
pub struct LpmTrieKeys<'coll, K: Pod> {
|
|
|
|
map: &'coll MapData,
|
|
|
|
map: &'coll MapData,
|
|
|
|
err: bool,
|
|
|
|
err: bool,
|
|
|
|
key: Key<K>,
|
|
|
|
key: Key<K>,
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
impl<'coll, K: Pod> LpnTrieKeys<'coll, K> {
|
|
|
|
impl<'coll, K: Pod> LpmTrieKeys<'coll, K> {
|
|
|
|
fn new(map: &'coll MapData, key: Key<K>) -> LpnTrieKeys<'coll, K> {
|
|
|
|
fn new(map: &'coll MapData, key: Key<K>) -> LpmTrieKeys<'coll, K> {
|
|
|
|
LpnTrieKeys {
|
|
|
|
LpmTrieKeys {
|
|
|
|
map,
|
|
|
|
map,
|
|
|
|
err: false,
|
|
|
|
err: false,
|
|
|
|
key,
|
|
|
|
key,
|
|
|
@ -204,7 +204,7 @@ impl<'coll, K: Pod> LpnTrieKeys<'coll, K> {
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
impl<K: Pod> Iterator for LpnTrieKeys<'_, K> {
|
|
|
|
impl<K: Pod> Iterator for LpmTrieKeys<'_, K> {
|
|
|
|
type Item = Result<Key<K>, MapError>;
|
|
|
|
type Item = Result<Key<K>, MapError>;
|
|
|
|
|
|
|
|
|
|
|
|
fn next(&mut self) -> Option<Result<Key<K>, MapError>> {
|
|
|
|
fn next(&mut self) -> Option<Result<Key<K>, MapError>> {
|
|
|
|