Function rustdoc::html::highlight::string_without_closing_tag

source ·
fn string_without_closing_tag<T: Display>(
    out: &mut impl Write,
    text: T,
    klass: Option<Class>,
    href_context: &Option<HrefContext<'_, '_>>,
    open_tag: bool
) -> Option<&'static str>
Expand description

This function writes text into out with some modifications depending on klass:

  • If klass is None, text is written into out with no modification.
  • If klass is Some but klass.get_span() is None, it writes the text wrapped in a <span> with the provided klass.
  • If klass is Some and has a rustc_span::Span, it then tries to generate a link (<a> element) by retrieving the link information from the span_correspondence_map that was filled in span_map.rs::collect_spans_and_sources. If it cannot retrieve the information, then it’s the same as the second point (klass is Some but doesn’t have a rustc_span::Span).