Create a new [`BitIterator`] from the provided `buffer`, and `offset` and `len` in bits # Panic Panics if `buffer` is too short for the provided offset and length
(buffer: &'a [u8], offset: usize, len: usize)
| 38 | /// |
| 39 | /// Panics if `buffer` is too short for the provided offset and length |
| 40 | pub fn new(buffer: &'a [u8], offset: usize, len: usize) -> Self { |
| 41 | let end_offset = offset.checked_add(len).unwrap(); |
| 42 | let required_len = ceil(end_offset, 8); |
| 43 | assert!( |
| 44 | buffer.len() >= required_len, |
| 45 | "BitIterator buffer too small, expected {required_len} got {}", |
| 46 | buffer.len() |
| 47 | ); |
| 48 | |
| 49 | Self { |
| 50 | buffer, |
| 51 | current_offset: offset, |
| 52 | end_offset, |
| 53 | } |
| 54 | } |
| 55 | } |
| 56 | |
| 57 | impl Iterator for BitIterator<'_> { |
nothing calls this directly
no test coverage detected