From 31fe56e8a3f1d4b87d07e285ac412ad558ae782e Mon Sep 17 00:00:00 2001 From: Federico Gimenez Date: Wed, 13 Nov 2024 12:00:53 +0100 Subject: [PATCH] feat: impl Extend for ProofNodes (#63) --- src/proof/proof_nodes.rs | 11 +++++++++++ 1 file changed, 11 insertions(+) diff --git a/src/proof/proof_nodes.rs b/src/proof/proof_nodes.rs index 81a306c..d1f5f4b 100644 --- a/src/proof/proof_nodes.rs +++ b/src/proof/proof_nodes.rs @@ -23,6 +23,12 @@ impl FromIterator<(Nibbles, Bytes)> for ProofNodes { } } +impl Extend<(Nibbles, Bytes)> for ProofNodes { + fn extend>(&mut self, iter: T) { + self.0.extend(iter); + } +} + impl ProofNodes { /// Return iterator over proof nodes that match the target. pub fn matching_nodes_iter<'a>( @@ -67,4 +73,9 @@ impl ProofNodes { pub fn into_inner(self) -> HashMap { self.0 } + + /// Extends with the elements of another `ProofNodes`. + pub fn extend_from(&mut self, other: Self) { + self.extend(other.0); + } }