Skip to content

Commit

Permalink
Add Default impl for types with Self::new
Browse files Browse the repository at this point in the history
  • Loading branch information
str4d committed Sep 8, 2021
1 parent 6ca2c41 commit 2257eca
Show file tree
Hide file tree
Showing 3 changed files with 14 additions and 0 deletions.
2 changes: 2 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -13,6 +13,8 @@ and this project adheres to Rust's notion of
`bellman` will use. The default, which has not changed, is to use the same
number of threads as logical CPUs.
- `bellman::multicore::Waiter`
- `Default` bound for `bellman::multiexp::DensityTracker`.
- `Default` bound for `bellman::gadgets::test::TestConstraintSystem`.

### Changed
- `bellman::multicore` has migrated from `crossbeam` to `rayon`:
Expand Down
6 changes: 6 additions & 0 deletions src/gadgets/test/mod.rs
Original file line number Diff line number Diff line change
Expand Up @@ -135,6 +135,12 @@ fn eval_lc<Scalar: PrimeField>(
acc
}

impl<Scalar: PrimeField> Default for TestConstraintSystem<Scalar> {
fn default() -> Self {
Self::new()
}
}

impl<Scalar: PrimeField> TestConstraintSystem<Scalar> {
pub fn new() -> TestConstraintSystem<Scalar> {
let mut map = HashMap::new();
Expand Down
6 changes: 6 additions & 0 deletions src/multiexp.rs
Original file line number Diff line number Diff line change
Expand Up @@ -130,6 +130,12 @@ impl<'a> QueryDensity for &'a DensityTracker {
}
}

impl Default for DensityTracker {
fn default() -> Self {
Self::new()
}
}

impl DensityTracker {
pub fn new() -> DensityTracker {
DensityTracker { bv: BitVec::new() }
Expand Down

0 comments on commit 2257eca

Please sign in to comment.