Revert "U13: remove BitWriter::with_capacity; no caller anywhere"
Browse files at this commita8775a4eee8c26a7f18423c798160c7a5a0a2752Parent: 4d056341 changed file +8 -0
crates/ec-core/src/bitio.rsmodified+8 -0
| @@ -151,6 +151,14 @@ impl BitWriter { | |||
| 151 | BitWriter::default() | 151 | BitWriter::default() |
| 152 | } | 152 | } |
| 153 | 153 | ||
| 154 | + /// An empty writer with room for `bytes`. | ||
| 155 | + pub fn with_capacity(bytes: usize) -> BitWriter { | ||
| 156 | + BitWriter { | ||
| 157 | + buf: Vec::with_capacity(bytes), | ||
| 158 | + used: 0, | ||
| 159 | + } | ||
| 160 | + } | ||
| 161 | + | ||
| 154 | /// Bits written so far. | 162 | /// Bits written so far. |
| 155 | pub fn bit_len(&self) -> u64 { | 163 | pub fn bit_len(&self) -> u64 { |
| 156 | if self.used == 0 { | 164 | if self.used == 0 { |