Skip to main content

comment_lines

Function comment_lines 

Source
pub fn comment_lines<'arena>(
    trivia: &Trivia<'arena>,
) -> Vec<(u32, &'arena [u8])>
Expand description

Splits a comment into lines, preserving the offset of each line from the start of the trivia.

This is crucial for calculating the precise Span of pragmas within a comment.

ยงReturns

A Vec of (u32, &[u8]) tuples, where the u32 is the byte offset of the line from the start of the entire trivia text (including /**, //, etc.), and the &[u8] is the cleaned line content.