Module rustdoc::html::render[−][src]

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

cache
context
print_item
write_shared

Structs

AllTypes
Generic

A type used for the search index.

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.

IndexItemFunctionType

Full type of functions/methods in the search index.

ItemEntry
RenderType

A type used for the search index.

SharedContext

Shared mutable state used in Context and elsewhere.

StylePath
TypeWithKind

Enums

AssocItemLink
Setting

Constants

ALLOWED_ATTRIBUTES
BASIC_KEYWORDS
CURRENT_DEPTH
INITIAL_IDS

Functions

assoc_const
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_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_id_for_impl_on_foreign_type
get_methods
get_next_url
get_struct_fields_name
item_ty_to_strs
naive_assoc_href
portability
print_sidebar
render_assoc_item
render_assoc_items
render_attributes
render_deref_methods
render_impl
render_impls
render_markdown

Render md_text as markdown.

render_stability_since_raw
settings
short_item_info

Render the stability, deprecation and portability information that is displayed at the top of the item’s documentation.

should_render_item
sidebar_assoc_items
sidebar_deref_methods
sidebar_enum
sidebar_foreign_type
sidebar_module
sidebar_primitive
sidebar_struct
sidebar_trait
sidebar_typedef
sidebar_union
small_url_encode
spotlight_decl
write_srclink

Type Definitions

NameDoc

A pair of name and its optional document.