Slices this [`BooleanBuffer`] by the provided `offset` and `length`
(&self, offset: usize, len: usize)
| 513 | |
| 514 | /// Slices this [`BooleanBuffer`] by the provided `offset` and `length` |
| 515 | pub fn slice(&self, offset: usize, len: usize) -> Self { |
| 516 | assert!( |
| 517 | offset.saturating_add(len) <= self.bit_len, |
| 518 | "the length + offset of the sliced BooleanBuffer cannot exceed the existing length" |
| 519 | ); |
| 520 | Self { |
| 521 | buffer: self.buffer.clone(), |
| 522 | bit_offset: self.bit_offset + offset, |
| 523 | bit_len: len, |
| 524 | } |
| 525 | } |
| 526 | |
| 527 | /// Returns a new [`Buffer`] containing the sliced contents of this [`BooleanBuffer`] |
| 528 | /// |