[−][src]Struct rustdoc_highlight::Classifier
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]
pub fn new(lexer: StringReader<'a>, source_map: &'a SourceMap) -> Classifier<'a>
[src]
pub fn write_source<W: Writer>(
&mut self,
out: &mut W
) -> Result<(), HighlightError>
[src]
&mut self,
out: &mut W
) -> Result<(), HighlightError>
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.
Auto Trait Implementations
impl<'a> Unpin for Classifier<'a>
impl<'a> !Send for Classifier<'a>
impl<'a> !Sync for Classifier<'a>
impl<'a> !RefUnwindSafe for Classifier<'a>
impl<'a> !UnwindSafe for Classifier<'a>
Blanket Implementations
impl<T> From<T> for T
[src]
impl<T, U> Into<U> for T where
U: From<T>,
[src]
U: From<T>,
impl<T, U> TryFrom<U> for T where
U: Into<T>,
[src]
U: Into<T>,
type Error = Infallible
The type returned in the event of a conversion error.
fn try_from(value: U) -> Result<T, <T as TryFrom<U>>::Error>
[src]
impl<T, U> TryInto<U> for T where
U: TryFrom<T>,
[src]
U: TryFrom<T>,
type Error = <U as TryFrom<T>>::Error
The type returned in the event of a conversion error.
fn try_into(self) -> Result<U, <U as TryFrom<T>>::Error>
[src]
impl<T> BorrowMut<T> for T where
T: ?Sized,
[src]
T: ?Sized,
fn borrow_mut(&mut self) -> &mut T
[src]
impl<T> Borrow<T> for T where
T: ?Sized,
[src]
T: ?Sized,
impl<T> Any for T where
T: 'static + ?Sized,
[src]
T: 'static + ?Sized,
impl<E> SpecializationError for E
[src]
default fn not_found<S, T>(
trait_name: &'static str,
method_name: &'static str
) -> E where
T: ?Sized,
[src]
trait_name: &'static str,
method_name: &'static str
) -> E where
T: ?Sized,