diff --git a/crates/ec-core/src/bitio.rs b/crates/ec-core/src/bitio.rs index b988c2ce..ce5ac10b 100644 --- a/crates/ec-core/src/bitio.rs +++ b/crates/ec-core/src/bitio.rs @@ -151,6 +151,14 @@ impl BitWriter { BitWriter::default() } + /// An empty writer with room for `bytes`. + pub fn with_capacity(bytes: usize) -> BitWriter { + BitWriter { + buf: Vec::with_capacity(bytes), + used: 0, + } + } + /// Bits written so far. pub fn bit_len(&self) -> u64 { if self.used == 0 {