From 8fe64aef1fa13cc2796ab62889526745203cd579 Mon Sep 17 00:00:00 2001 From: Ayrton Sparling Date: Thu, 8 Dec 2022 09:45:11 -0800 Subject: [PATCH] Fix lpmtrie iter returning nothing --- aya/src/maps/lpm_trie.rs | 9 ++++----- 1 file changed, 4 insertions(+), 5 deletions(-) diff --git a/aya/src/maps/lpm_trie.rs b/aya/src/maps/lpm_trie.rs index 696dcc50..94569206 100644 --- a/aya/src/maps/lpm_trie.rs +++ b/aya/src/maps/lpm_trie.rs @@ -128,7 +128,7 @@ impl, K: Pod, V: Pod> LpmTrie { /// An iterator visiting all key-value pairs in arbitrary order. The /// iterator item type is `Result<(K, V), MapError>`. - pub fn iter(&self) -> MapIter<'_, K, V, Self> { + pub fn iter(&self) -> MapIter<'_, Key, V, Self> { MapIter::new(self) } @@ -172,14 +172,13 @@ impl, K: Pod, V: Pod> LpmTrie { } } -impl, K: Pod, V: Pod> IterableMap for LpmTrie { +impl, K: Pod, V: Pod> IterableMap, V> for LpmTrie { fn map(&self) -> &MapData { self.inner.as_ref() } - fn get(&self, key: &K) -> Result { - let lookup = Key::new(mem::size_of::() as u32, *key); - self.get(&lookup, 0) + fn get(&self, key: &Key) -> Result { + self.get(key, 0) } }