Module highlighter

Module highlighter 

Expand description

This module provides a syntax highlighter for Rust code. It is used by the rustc --explain command.

The syntax highlighter uses rustc_lexer’s tokenize function to parse the Rust code into a Vec of tokens. The highlighter then highlights the tokens in the Vec, and writes the highlighted output to the buffer.

Structs§

Highlighter
A syntax highlighter for Rust code It is used by the rustc --explain command.

Functions§

highlight
Highlight a Rust code string and write the highlighted output to the buffer. It serves as a wrapper around Highlighter::highlight_rustc_lexer. It is passed to write_anstream_buf in the lib.rs file.