Convert a byte offset into a 1-based line number.
(&self, byte: usize)
| 49 | |
| 50 | /// Convert a byte offset into a 1-based line number. |
| 51 | pub fn line_for_byte(&self, byte: usize) -> usize { |
| 52 | match self.line_starts.binary_search(&byte) { |
| 53 | Ok(idx) => idx + 1, |
| 54 | Err(idx) => idx, |
| 55 | } |
| 56 | } |
| 57 | |
| 58 | /// Convert a byte offset into a 1-based column number. |
| 59 | pub fn column_for_byte(&self, byte: usize) -> usize { |
no outgoing calls
no test coverage detected