[−][src]Trait rustdoc::formats::renderer::FormatRenderer

pub(crate) trait FormatRenderer<'tcx>: Clone {
    pub(crate) fn init(
        krate: Crate,
        options: RenderOptions,
        render_info: RenderInfo,
        edition: Edition,
        cache: &mut Cache,
        tcx: TyCtxt<'tcx>
    ) -> Result<(Self, Crate), Error>;
pub(crate) fn item(
        &mut self,
        item: Item,
        cache: &Cache
    ) -> Result<(), Error>;
pub(crate) fn mod_item_in(
        &mut self,
        item: &Item,
        item_name: &str,
        cache: &Cache
    ) -> Result<(), Error>;
pub(crate) fn mod_item_out(&mut self, item_name: &str) -> Result<(), Error>;
pub(crate) fn after_krate(
        &mut self,
        krate: &Crate,
        cache: &Cache
    ) -> Result<(), Error>;
pub(crate) fn after_run(&mut self, diag: &Handler) -> Result<(), Error>; }

Allows for different backends to rustdoc to be used with the run_format() function. Each backend renderer has hooks for initialization, documenting an item, entering and exiting a module, and cleanup/finalizing output.

Required methods

pub(crate) fn init(
    krate: Crate,
    options: RenderOptions,
    render_info: RenderInfo,
    edition: Edition,
    cache: &mut Cache,
    tcx: TyCtxt<'tcx>
) -> Result<(Self, Crate), Error>
[src]

Sets up any state required for the renderer. When this is called the cache has already been populated.

pub(crate) fn item(&mut self, item: Item, cache: &Cache) -> Result<(), Error>[src]

Renders a single non-module item. This means no recursive sub-item rendering is required.

pub(crate) fn mod_item_in(
    &mut self,
    item: &Item,
    item_name: &str,
    cache: &Cache
) -> Result<(), Error>
[src]

Renders a module (should not handle recursing into children).

pub(crate) fn mod_item_out(&mut self, item_name: &str) -> Result<(), Error>[src]

Runs after recursively rendering all sub-items of a module.

pub(crate) fn after_krate(
    &mut self,
    krate: &Crate,
    cache: &Cache
) -> Result<(), Error>
[src]

Post processing hook for cleanup and dumping output to files.

pub(crate) fn after_run(&mut self, diag: &Handler) -> Result<(), Error>[src]

Called after everything else to write out errors.

Loading content...

Implementors

impl<'tcx> FormatRenderer<'tcx> for Context<'tcx>[src]

Generates the documentation for crate into the directory dst

impl<'tcx> FormatRenderer<'tcx> for JsonRenderer<'tcx>[src]

pub(crate) fn item(&mut self, item: Item, cache: &Cache) -> Result<(), Error>[src]

Inserts an item into the index. This should be used rather than directly calling insert on the hashmap because certain items (traits and types) need to have their mappings for trait implementations filled out before they're inserted.

Loading content...