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 🔒
- ordered_
json 🔒 - print_
item 🔒 - search_
index 🔒 - sidebar 🔒
- sorted_
template 🔒 - span_
map 🔒 - type_
layout 🔒 - write_
shared 🔒 - Rustdoc writes aut two kinds of shared files:
Structs§
- AllTypes 🔒
- Impl
Rendering 🔒Parameters - Index
Item 🔒 - 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.
- Index
Item 🔒Function Type - Full type of functions/methods in the search index.
- Item
Entry 🔒 - Item
Info 🔒 - Render
Type 🔒 - A type used for the search index.
- Style
Path 🔒
Enums§
- Assoc
Const 🔒Value - Assoc
Item 🔒Link - Assoc
Item 🔒Render - Specifies whether rendering directly implemented trait items or ones from a certain Deref impl.
- Item
Section 🔒 - Render
Mode 🔒 - For different handling of associated items from the Deref target of a type rather than the type itself.
- Render
Type 🔒Id - Short
Item 🔒Info
Constants§
Functions§
- assoc_
const 🔒 - assoc_
href_ 🔒attr - Build a (possibly empty)
href
attribute (a key-value pair) for the given associated item. - assoc_
method 🔒 - assoc_
type 🔒 - collect_
paths_ 🔒for_ type - 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 🔒
- document_
full 🔒 - document_
full_ 🔒collapsible - document_
full_ 🔒inner - document_
item_ 🔒info - Add extra information about an item such as:
- document_
short 🔒 - 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.
- ensure_
trailing_ 🔒slash - extract_
for_ 🔒impl_ name - get_
filtered_ 🔒impls_ for_ reference - 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
. - get_
id_ 🔒for_ impl - item_
ty_ 🔒to_ section - notable_
traits_ 🔒button - notable_
traits_ 🔒decl - notable_
traits_ 🔒json - portability 🔒
- render_
all_ 🔒impls - render_
assoc_ 🔒item - render_
assoc_ 🔒items - render_
assoc_ 🔒items_ inner - render_
attributes_ 🔒in_ code - render_
attributes_ 🔒in_ pre - render_
call_ 🔒locations - Generates the HTML for example call locations generated via the –scrape-examples flag.
- render_
deref_ 🔒methods - render_
impl 🔒 - render_
impl_ 🔒summary - render_
impls 🔒 - render_
markdown 🔒 - Render md_text as markdown.
- render_
rightside 🔒 - render_
stability_ 🔒since_ raw - render_
stability_ 🔒since_ raw_ with_ extra - 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)”.
- scrape_
examples_ 🔒help - short_
item_ 🔒info - Render the stability, deprecation and portability information that is displayed at the top of the item’s documentation.
- should_
render_ 🔒item - since_
to_ 🔒string - small_
url_ 🔒encode - write_
impl_ 🔒section_ heading - write_
section_ heading