From c2e037c56c7da3a09a1da21c49939e917d91a05b Mon Sep 17 00:00:00 2001 From: Leni Aniva Date: Wed, 1 Apr 2026 00:13:22 -0700 Subject: [PATCH 1/2] feat: Add `contains` function --- src/lib.rs | 8 ++++++++ 1 file changed, 8 insertions(+) diff --git a/src/lib.rs b/src/lib.rs index be47ea2..b787897 100644 --- a/src/lib.rs +++ b/src/lib.rs @@ -545,6 +545,14 @@ impl HConsign { Ok(init) } + #[inline] + pub fn contains(&self, elem: &T) -> bool + where + S: BuildHasher, + { + self.table.contains_key(elem) + } + /// The number of elements stored, mostly for testing. #[inline] pub fn len(&self) -> usize { From d5b44397a7fc5e7106468c12fa34080db5bbd7a2 Mon Sep 17 00:00:00 2001 From: Leni Aniva Date: Wed, 1 Apr 2026 00:18:25 -0700 Subject: [PATCH 2/2] feat: Add `HConsign::iter` function --- src/lib.rs | 7 +++++++ 1 file changed, 7 insertions(+) diff --git a/src/lib.rs b/src/lib.rs index b787897..4c56359 100644 --- a/src/lib.rs +++ b/src/lib.rs @@ -545,6 +545,13 @@ impl HConsign { Ok(init) } + /// Returns an iterator to the consign's contents + #[inline] + pub fn iter(&self) -> impl ExactSizeIterator { + self.table.keys() + } + + /// Determine if the consign contains an element #[inline] pub fn contains(&self, elem: &T) -> bool where