get_line_count_from_offset

Function get_line_count_from_offset 

Source
pub fn get_line_count_from_offset(contents: &[u8], offset: u32) -> u32
Expand description

Gets the line number for a given offset (of bytes) from the given buffer contents.

The offset given to this function is expected to originate from diagnostic information provided by clang-format. Any offset out of bounds is clamped to the given contents buffer’s length.