| 1 |
# Writing Into a Bit-Vector |
| 2 |
|
| 3 |
The implementation appends bytes to the referenced bit-vector until the source |
| 4 |
buffer is exhausted. |
| 5 |
|
| 6 |
Note that the return value of `.write()` is always the number of *bytes* of |
| 7 |
`buf` consumed! |
| 8 |
|
| 9 |
The implementation uses [`BitField::store_be`] to fill bytes. Note that unlike |
| 10 |
the standard library, it is implemented on bit-vectors of *any* underlying |
| 11 |
element type. However, using a `BitVec<_, u8>` is still likely to be fastest. |
| 12 |
|
| 13 |
## Original |
| 14 |
|
| 15 |
[`impl Write for Vec<u8>`][orig] |
| 16 |
|
| 17 |
[orig]: https://doc.rust-lang.org/std/vec/struct.Vec.html#impl-Write |
| 18 |
[`BitField::store_be`]: crate::field::BitField::store_be |