byte_offset_to_line_and_column() — tailwindcss Function Reference
Architecture documentation for the byte_offset_to_line_and_column() function in pre_processor.rs from the tailwindcss codebase.
Entity Profile
Dependency Diagram
graph TD acf51aa5_5f7b_df93_84da_864fca325db6["byte_offset_to_line_and_column()"] 8d77aabf_954c_b962_4322_6d819b1af944["pre_processor.rs"] acf51aa5_5f7b_df93_84da_864fca325db6 -->|defined in| 8d77aabf_954c_b962_4322_6d819b1af944 style acf51aa5_5f7b_df93_84da_864fca325db6 fill:#6366f1,stroke:#818cf8,color:#fff
Relationship Graph
Source Code
crates/oxide/src/extractor/pre_processors/pre_processor.rs lines 165–186
fn byte_offset_to_line_and_column(input: &[u8], offset: usize) -> (usize, usize) {
use unicode_width::UnicodeWidthStr;
let mut line_start = 0;
let mut line = 0;
for (i, &b) in input.iter().enumerate() {
if i >= offset {
break;
}
if b == b'\n' {
line += 1;
line_start = i + 1;
}
}
let slice = &input[line_start..offset];
let column = std::str::from_utf8(slice).expect("Valid UTF-8");
let column = UnicodeWidthStr::width(column);
(line, column)
}
Domain
Subdomains
Source
Frequently Asked Questions
What does byte_offset_to_line_and_column() do?
byte_offset_to_line_and_column() is a function in the tailwindcss codebase, defined in crates/oxide/src/extractor/pre_processors/pre_processor.rs.
Where is byte_offset_to_line_and_column() defined?
byte_offset_to_line_and_column() is defined in crates/oxide/src/extractor/pre_processors/pre_processor.rs at line 165.
Analyze Your Own Codebase
Get architecture documentation, dependency graphs, and domain analysis for your codebase in minutes.
Try Supermodel Free