Add a new range which begins at the end of the previous range and ends at the specified offset, exclusive.
(&mut self, end: usize)
| 23 | /// Add a new range which begins at the end of the previous range |
| 24 | /// and ends at the specified offset, exclusive. |
| 25 | pub fn push_end(&mut self, end: usize) { |
| 26 | debug_assert!(!self.reverse); |
| 27 | // To keep this implementation simple we explicitly store the |
| 28 | // starting index, which is always 0, so that all ranges are |
| 29 | // represented by adjacent pairs in the list. But we add it |
| 30 | // lazily so that an empty list doesn't have to allocate. |
| 31 | if self.ranges.is_empty() { |
| 32 | self.ranges.push(0); |
| 33 | } |
| 34 | self.ranges.push(u32::try_from(end).unwrap()); |
| 35 | } |
| 36 | |
| 37 | /// Number of ranges in this list. |
| 38 | pub fn len(&self) -> usize { |
no test coverage detected