Skip to content

Commit 6c3f53d

Browse files
committed
[fix] clarify counts() use, rm into_parts() and explicit deconstruct
1 parent 9b746eb commit 6c3f53d

File tree

1 file changed

+8
-9
lines changed

1 file changed

+8
-9
lines changed

lib/types/mod.rs

Lines changed: 8 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -366,19 +366,14 @@ impl AccumulatorDiff {
366366
}
367367
}
368368

369+
/// Returns the number of tracked insertions and deletions, in that order.
369370
pub fn counts(&self) -> (usize, usize) {
370371
(self.insertions, self.deletions)
371372
}
372373

373374
pub fn is_empty(&self) -> bool {
374375
self.diff.is_empty()
375376
}
376-
377-
pub fn into_parts(
378-
self,
379-
) -> (LinkedHashMap<BitcoinNodeHash, bool>, usize, usize) {
380-
(self.diff, self.insertions, self.deletions)
381-
}
382377
}
383378

384379
#[derive(Debug, Error)]
@@ -395,10 +390,14 @@ impl Accumulator {
395390
&mut self,
396391
diff: AccumulatorDiff,
397392
) -> Result<(), UtreexoError> {
398-
let (diff, insertions_len, deletions_len) = diff.into_parts();
393+
let AccumulatorDiff {
394+
diff,
395+
insertions: n_insertions,
396+
deletions: n_deletions,
397+
} = diff;
399398
let (mut insertions, mut deletions) = (
400-
Vec::with_capacity(insertions_len),
401-
Vec::with_capacity(deletions_len),
399+
Vec::with_capacity(n_insertions),
400+
Vec::with_capacity(n_deletions),
402401
);
403402
for (utxo_hash, insert) in diff {
404403
if insert {

0 commit comments

Comments
 (0)