Skip to content

Commit

Permalink
Merge pull request #93 from dusk-network/add-default-tree
Browse files Browse the repository at this point in the history
dusk-merkle: add `Default` implementation for `Tree`
  • Loading branch information
Eduardo Leegwater Simões authored Sep 9, 2024
2 parents 00f0ce9 + c28b99c commit 87bb0dd
Show file tree
Hide file tree
Showing 2 changed files with 10 additions and 0 deletions.
1 change: 1 addition & 0 deletions dusk-merkle/CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,7 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0

## Added

- Add `Default` implementation for `Tree`
- Add bounds check on `Tree::insert`, improving panic message [#91]

## [0.5.2] - 2023-10-27
Expand Down
9 changes: 9 additions & 0 deletions dusk-merkle/src/tree.rs
Original file line number Diff line number Diff line change
Expand Up @@ -21,6 +21,15 @@ pub struct Tree<T, const H: usize, const A: usize> {
positions: BTreeSet<u64>,
}

impl<T, const H: usize, const A: usize> Default for Tree<T, H, A>
where
T: Aggregate<A>,
{
fn default() -> Self {
Self::new()
}
}

impl<T, const H: usize, const A: usize> Tree<T, H, A>
where
T: Aggregate<A>,
Expand Down

0 comments on commit 87bb0dd

Please sign in to comment.