Module rustdoc::html::render

source ·
Expand description

Rustdoc’s HTML rendering module.

This modules contains the bulk of the logic necessary for rendering a rustdoc clean::Crate instance to a set of static HTML pages. This rendering process is largely driven by the format! syntax extension to perform all I/O into files and streams.

The rendering process is largely driven by the Context and Cache structures. The cache is pre-populated by crawling the crate in question, and then it is shared among the various rendering threads. The cache is meant to be a fairly large structure not implementing Clone (because it’s shared among threads). The context, however, should be a lightweight structure. This is cloned per-thread and contains information about what is currently being rendered.

In order to speed up rendering (mostly because of markdown rendering), the rendering process has been parallelized. This parallelization is only exposed through the crate method on the context, and then also from the fact that the shared cache is stored in TLS (and must be accessed as such).

In addition to rendering the crate itself, this module is also responsible for creating the corresponding search index and source file renderings. These threads are not parallelized (they haven’t been a bottleneck yet), and both occur before the crate is rendered.

Modules

context 🔒
print_item 🔒
span_map 🔒

Structs

AllTypes 🔒
IndexItem 🔒
Struct representing one entry in the JS search index. These are all emitted by hand to a large JS file at the end of cache-creation.
Full type of functions/methods in the search index.
ItemEntry 🔒
RenderType 🔒
A type used for the search index.
StylePath 🔒

Enums

Constants

Functions

Build a (possibly empty) href attribute (a key-value pair) for the given associated item.
assoc_type 🔒
attributes 🔒
Returns a list of all paths used in the type. This is used to help deduplicate imported impls for reexported types. If any of the contained types are re-exported, we don’t use the corresponding entry from the js file, as inlining will have already picked up the impl
document 🔒
Add extra information about an item such as:
Writes a documentation block containing only the first paragraph of the documentation. If the docs are longer, a “Read more” link is appended to the end.
Returns the list of implementations for the primitive reference type, filtering out any implementations that are on concrete or partially generic types, only keeping implementations of the form impl<T> Trait for &T.
Generates the HTML for example call locations generated via the –scrape-examples flag.
Render md_text as markdown.
Writes a span containing the versions at which an item became stable and/or const-stable. For example, if the item became stable at 1.0.0, and const-stable at 1.45.0, this function would write a span containing “1.0.0 (const: 1.45.0)”.
Render the stability, deprecation and portability information that is displayed at the top of the item’s documentation.

Type Definitions

NameDoc 🔒
A pair of name and its optional document.