Struct rustdoc::html::highlight::Classifier [] [src]

pub struct Classifier<'a> {
    // some fields omitted
}
Unstable (rustdoc)

Processes a program (nested in the internal lexer), classifying strings of text by highlighting category (Class). Calls out to a Writer to write each span of text in sequence.

Methods

impl<'a> Classifier<'a>
[src]

fn new(lexer: StringReader<'a>, codemap: &'a CodeMap) -> Classifier<'a>

fn write_source<W: Writer>(&mut self, out: &mut W) -> Result<()>

Unstable (rustdoc)

Exhausts the lexer writing the output into out.

The general structure for this method is to iterate over each token, possibly giving it an HTML span with a class specifying what flavor of token is used. All source code emission is done as slices from the source map, not from the tokens themselves, in order to stay true to the original source.