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 423e9765_15bd_5eb2_da5e_e7f8dd8d4711["byte_offset_to_line_and_column()"] c9eebb75_dc3f_0649_0b9f_ee56e4ee9c1c["pre_processor.rs"] 423e9765_15bd_5eb2_da5e_e7f8dd8d4711 -->|defined in| c9eebb75_dc3f_0649_0b9f_ee56e4ee9c1c style 423e9765_15bd_5eb2_da5e_e7f8dd8d4711 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