Skip to main content

highlight_rust

Function highlight_rust 

Source
pub fn highlight_rust(line: &str) -> Line<'static>
Expand description

Highlight one line of Rust source. Returns an owned Line of styled spans suitable for handing to ratatui::widgets::Paragraph::new.

Stateless per-line highlighting — multi-line strings or block comments may render with the wrong colour past their first line. Acceptable for the source pane’s ~30-line window; bat uses the same trade-off when rendering small slices.