Skip to content

Commit

Permalink
Add with_capacity creator for BitRecorder
Browse files Browse the repository at this point in the history
  • Loading branch information
tuffy committed Dec 29, 2020
1 parent 43bcb62 commit 34e5d5b
Showing 1 changed file with 9 additions and 0 deletions.
9 changes: 9 additions & 0 deletions src/write.rs
Original file line number Diff line number Diff line change
Expand Up @@ -827,6 +827,15 @@ impl<N: Default + Copy, E: Endianness> BitRecorder<N, E> {
}
}

/// Creates new recorder sized for the given number of writes
#[inline]
pub fn with_capacity(writes: usize) -> Self {
BitRecorder {
counter: BitCounter::new(),
records: Vec::with_capacity(writes),
}
}

/// Creates new recorder with the given endiannness
#[inline]
pub fn endian(_endian: E) -> Self {
Expand Down

0 comments on commit 34e5d5b

Please sign in to comment.