Skip to content

Commit

Permalink
feat: make BitField::new const (#850)
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 authored Jun 30, 2023
1 parent 3ad5b90 commit 2138878
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 2138878

Please sign in to comment.