Struct rustdoc::html::render::context::Context [−][src]
pub(crate) struct Context<'tcx> {
pub(crate) current: Vec<String>,
pub(crate) dst: PathBuf,
pub(super) render_redirect_pages: bool,
pub(super) id_map: RefCell<IdMap>,
pub(crate) shared: Rc<SharedContext<'tcx>>,
pub(crate) include_sources: bool,
}
Expand description
Major driving force in all rustdoc rendering. This contains information about where in the tree-like hierarchy rendering is occurring and controls how the current page is being rendered.
It is intended that this context is a lightweight object which can be fairly easily cloned because it is cloned per work-job (about once per item in the rustdoc tree).
Fields
current: Vec<String>
Current hierarchy of components leading down to what’s currently being rendered
dst: PathBuf
The current destination folder of where HTML artifacts should be placed. This changes as the context descends into the module hierarchy.
render_redirect_pages: bool
A flag, which when true
, will render pages which redirect to the
real location of an item. This is used to allow external links to
publicly reused items to redirect to the right location.
id_map: RefCell<IdMap>
The map used to ensure all generated ‘id=’ attributes are unique.
Shared mutable state.
Issue for improving the situation: #82381
include_sources: bool
This flag indicates whether [src]
links should be generated or not. If
the source files are present in the html rendering, then this will be
true
.
Implementations
String representation of how to get back to the root path of the ‘doc/’ folder in terms of a relative URL.
Construct a map of items shown in the sidebar to a plain-text summary of their docs.
Generates a url appropriate for an href
attribute back to the source of
this item.
The url generated, when clicked, will redirect the browser back to the original source code.
If None
is returned, then a source link couldn’t be generated. This
may happen, for example, with externally inlined items where the source
of their crate documentation isn’t known.
Trait Implementations
Generates the documentation for crate
into the directory dst
Whether to call item
recursivly for modules Read more
Sets up any state required for the renderer. When this is called the cache has already been populated. Read more
Make a new renderer to render a child of the item currently being rendered.
Post processing hook for cleanup and dumping output to files.
Renders a module (should not handle recursing into children).
Runs after recursively rendering all sub-items of a module.
Renders a single non-module item. This means no recursive sub-item rendering is required.
Auto Trait Implementations
impl<'tcx> !RefUnwindSafe for Context<'tcx>
impl<'tcx> !UnwindSafe for Context<'tcx>
Blanket Implementations
Mutably borrows from an owned value. Read more
Instruments this type with the provided Span
, returning an
Instrumented
wrapper. Read more
pub fn vzip(self) -> V
Attaches the provided Subscriber
to this type, returning a
WithDispatch
wrapper. Read more
Attaches the current default Subscriber
to this type, returning a
WithDispatch
wrapper. Read more
Layout
Note: Most layout information is completely unstable and may even differ between compilations. The only exception is types with certain repr(...)
attributes. Please see the Rust Reference’s “Type Layout” chapter for details on type layout guarantees.
Size: 104 bytes