Skip to content

Commit

Permalink
feat: make BitField::new const
Browse files Browse the repository at this point in the history
This won't actually improve performance, but may help with some
ergonomics.
  • Loading branch information
Stebalien committed Sep 8, 2022
1 parent 9b1f206 commit 9af4004
Showing 1 changed file with 6 additions and 2 deletions.
8 changes: 6 additions & 2 deletions ipld/bitfield/src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -133,8 +133,12 @@ impl FromIterator<u64> for MaybeBitField {

impl BitField {
/// Creates an empty bit field.
pub fn new() -> Self {
Self::default()
pub const fn new() -> Self {
Self {
ranges: Vec::new(),
set: BTreeSet::new(),
unset: BTreeSet::new(),
}
}

/// Creates a new bit field from a `RangeIterator`.
Expand Down

0 comments on commit 9af4004

Please sign in to comment.