Debian Codegraph @

debian/rust-vendor/bitvec/doc/field/io/Read_BitSlice.md

raw
1 # Reading From a Bit-Slice
2
3 The implementation loads bytes out of the referenced bit-slice until either the
4 destination buffer is filled or the source has no more bytes to provide. When
5 `.read()` returns, the provided bit-slice handle will have been updated to no
6 longer include the leading segment copied out as bytes into `buf`.
7
8 Note that the return value of `.read()` is always the number of *bytes* of `buf`
9 filled!
10
11 The implementation uses [`BitField::load_be`] to collect bytes. Note that unlike
12 the standard library, it is implemented on bit-slices of *any* underlying
13 element type. However, using a `BitSlice<_, u8>` is still likely to be fastest.
14
15 ## Original
16
17 [`impl Read for [u8]`][orig]
18
19 [orig]: https://doc.rust-lang.org/std/primitive.slice.html#impl-Read
20 [`BitField::load_be`]: crate::field::BitField::load_be