Skip to content

Commit 0ae2f43

Browse files
committed
feat: make BitField::new const
This won't actually improve performance, but may help with some ergonomics.
1 parent 3ad5b90 commit 0ae2f43

File tree

1 file changed

+6
-2
lines changed

1 file changed

+6
-2
lines changed

ipld/bitfield/src/lib.rs

+6-2
Original file line numberDiff line numberDiff line change
@@ -133,8 +133,12 @@ impl FromIterator<u64> for MaybeBitField {
133133

134134
impl BitField {
135135
/// Creates an empty bit field.
136-
pub fn new() -> Self {
137-
Self::default()
136+
pub const fn new() -> Self {
137+
Self {
138+
ranges: Vec::new(),
139+
set: BTreeSet::new(),
140+
unset: BTreeSet::new(),
141+
}
138142
}
139143

140144
/// Creates a new bit field from a `RangeIterator`.

0 commit comments

Comments
 (0)