Struct rustdoc::html::highlight::Classifier [−][src]
struct Classifier<'a> {
tokens: Peekable<TokenIter<'a>>,
in_attribute: bool,
in_macro: bool,
in_macro_nonterminal: bool,
edition: Edition,
byte_pos: u32,
src: &'a str,
}Expand description
Processes program tokens, classifying strings of text by highlighting
category (Class).
Fields
tokens: Peekable<TokenIter<'a>>in_attribute: boolin_macro: boolin_macro_nonterminal: booledition: Editionbyte_pos: u32src: &'a strImplementations
impl<'a> Classifier<'a>[src]
impl<'a> Classifier<'a>[src]fn new(src: &str, edition: Edition) -> Classifier<'_>[src]
fn get_full_ident_path(&mut self) -> Vec<(TokenKind, usize, usize)>[src]
fn get_full_ident_path(&mut self) -> Vec<(TokenKind, usize, usize)>[src]Concatenate colons and idents as one when possible.
fn next(&mut self) -> Option<(TokenKind, &'a str)>[src]
fn next(&mut self) -> Option<(TokenKind, &'a str)>[src]Wraps the tokens iteration to ensure that the byte_pos is always correct.
fn highlight(self, sink: &mut dyn FnMut(Highlight<'a>))[src]
fn highlight(self, sink: &mut dyn FnMut(Highlight<'a>))[src]Exhausts the Classifier writing the output into sink.
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.
fn advance(
&mut self,
token: TokenKind,
text: &'a str,
sink: &mut dyn FnMut(Highlight<'a>)
)[src]
fn advance(
&mut self,
token: TokenKind,
text: &'a str,
sink: &mut dyn FnMut(Highlight<'a>)
)[src]Single step of highlighting. This will classify token, but maybe also
a couple of following ones as well.
fn peek(&mut self) -> Option<TokenKind>[src]
Auto Trait Implementations
impl<'a> RefUnwindSafe for Classifier<'a>
impl<'a> Send for Classifier<'a>
impl<'a> Sync for Classifier<'a>
impl<'a> Unpin for Classifier<'a>
impl<'a> UnwindSafe for Classifier<'a>
Blanket Implementations
impl<T> BorrowMut<T> for T where
T: ?Sized, [src]
impl<T> BorrowMut<T> for T where
T: ?Sized, [src]pub fn borrow_mut(&mut self) -> &mut T[src]
pub fn borrow_mut(&mut self) -> &mut T[src]Mutably borrows from an owned value. Read more
impl<T> Instrument for T[src]
impl<T> Instrument for T[src]fn instrument(self, span: Span) -> Instrumented<Self>[src]
fn instrument(self, span: Span) -> Instrumented<Self>[src]Instruments this type with the provided Span, returning an
Instrumented wrapper. Read more
fn in_current_span(self) -> Instrumented<Self>[src]
fn in_current_span(self) -> Instrumented<Self>[src]impl<V, T> VZip<V> for T where
V: MultiLane<T>,
impl<V, T> VZip<V> for T where
V: MultiLane<T>, pub fn vzip(self) -> V
impl<T> WithConstness for T[src]
impl<T> WithConstness for T[src]fn with_constness(self, constness: Constness) -> ConstnessAnd<Self>[src]
fn with_const(self) -> ConstnessAnd<Self>[src]
fn without_const(self) -> ConstnessAnd<Self>[src]
impl<'a, T> Captures<'a> for T where
T: ?Sized, [src]
T: ?Sized,