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
isNone
,text
is written intoout
with no modification. - If
klass
isSome
butklass.get_span()
isNone
, it writes the text wrapped in a<span>
with the providedklass
. - If
klass
isSome
and has arustc_span::Span
, it then tries to generate a link (<a>
element) by retrieving the link information from thespan_correspondence_map
that was filled inspan_map.rs::collect_spans_and_sources
. If it cannot retrieve the information, then it’s the same as the second point (klass
isSome
but doesn’t have arustc_span::Span
).