From 434f7b7150e0f014a34934999005e2cd9c9b44a7 Mon Sep 17 00:00:00 2001 From: Roman Krasiuk Date: Wed, 22 May 2024 15:40:17 +0200 Subject: [PATCH 1/2] chore(trie): `PrefixSet::iter` --- crates/trie/src/prefix_set/mod.rs | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/crates/trie/src/prefix_set/mod.rs b/crates/trie/src/prefix_set/mod.rs index b556dd379075..1c39df98150d 100644 --- a/crates/trie/src/prefix_set/mod.rs +++ b/crates/trie/src/prefix_set/mod.rs @@ -161,6 +161,11 @@ impl PrefixSet { false } + /// Returns an iterator over reference to _all_ nibbles regardless of cursor position. + pub fn iter(&self) -> core::slice::Iter<'_, Nibbles> { + self.keys.as_ref().iter() + } + /// Returns the number of elements in the set. pub fn len(&self) -> usize { self.keys.len() From 3ad21575f088e95b90aa8d8bdec319adb3fd0d63 Mon Sep 17 00:00:00 2001 From: Roman Krasiuk Date: Wed, 22 May 2024 15:44:48 +0200 Subject: [PATCH 2/2] nit --- crates/trie/src/prefix_set/mod.rs | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/crates/trie/src/prefix_set/mod.rs b/crates/trie/src/prefix_set/mod.rs index 1c39df98150d..32fdc68c812d 100644 --- a/crates/trie/src/prefix_set/mod.rs +++ b/crates/trie/src/prefix_set/mod.rs @@ -163,7 +163,7 @@ impl PrefixSet { /// Returns an iterator over reference to _all_ nibbles regardless of cursor position. pub fn iter(&self) -> core::slice::Iter<'_, Nibbles> { - self.keys.as_ref().iter() + self.keys.iter() } /// Returns the number of elements in the set.