Struct rustdoc::html::render::Context [−][src]
pub struct Context { pub current: Vec<String>, pub dst: PathBuf, pub render_redirect_pages: bool, pub shared: Arc<SharedContext>, }
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.
Methods
impl Context
[src]
impl Context
fn root_path(&self) -> String
[src]
fn root_path(&self) -> String
String representation of how to get back to the root path of the 'doc/' folder in terms of a relative URL.
fn recurse<T, F>(&mut self, s: String, f: F) -> T where
F: FnOnce(&mut Context) -> T,
[src]
fn recurse<T, F>(&mut self, s: String, f: F) -> T where
F: FnOnce(&mut Context) -> T,
Recurse in the directory structure and change the "root path" to make sure it always points to the top (relatively).
fn krate(self, krate: Crate) -> Result<(), Error>
[src]
fn krate(self, krate: Crate) -> Result<(), Error>
Main method for rendering a crate.
This currently isn't parallelized, but it'd be pretty easy to add parallelization to this function.
fn render_item(
&self,
writer: &mut Write,
it: &Item,
pushname: bool
) -> Result<()>
[src]
fn render_item(
&self,
writer: &mut Write,
it: &Item,
pushname: bool
) -> Result<()>
fn item<F>(&mut self, item: Item, all: &mut AllTypes, f: F) -> Result<(), Error> where
F: FnMut(&mut Context, Item),
[src]
fn item<F>(&mut self, item: Item, all: &mut AllTypes, f: F) -> Result<(), Error> where
F: FnMut(&mut Context, Item),
Non-parallelized version of rendering an item. This will take the input item, render its contents, and then invoke the specified closure with all sub-items which need to be rendered.
The rendering driver uses this closure to queue up more work.