Skip to main content

offset_of

Function offset_of 

Source
pub fn offset_of(
    content: &str,
    line: u32,
    character: u32,
) -> Result<usize, String>
Expand description

Convert a 0-based (line, character) coordinate to a byte offset into content. line/character count UTF-8 bytes per line (wire convention here is byte columns, matching how Rust slices &str). Out-of-range → Err.