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

pub trait FormatRenderer: Clone {
    fn init(
        krate: Crate,
        options: RenderOptions,
        render_info: RenderInfo,
        edition: Edition,
        cache: &mut Cache
    ) -> Result<(Self, Crate), Error>;
fn item(&mut self, item: Item, cache: &Cache) -> Result<(), Error>;
fn mod_item_in(
        &mut self,
        item: &Item,
        item_name: &str,
        cache: &Cache
    ) -> Result<(), Error>;
fn mod_item_out(&mut self, item_name: &str) -> Result<(), Error>;
fn after_krate(&mut self, krate: &Crate, cache: &Cache) -> Result<(), Error>;
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

fn init(
    krate: Crate,
    options: RenderOptions,
    render_info: RenderInfo,
    edition: Edition,
    cache: &mut Cache
) -> Result<(Self, Crate), Error>

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

fn item(&mut self, item: Item, cache: &Cache) -> Result<(), Error>

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

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

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

fn mod_item_out(&mut self, item_name: &str) -> Result<(), Error>

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

fn after_krate(&mut self, krate: &Crate, cache: &Cache) -> Result<(), Error>

Post processing hook for cleanup and dumping output to files.

fn after_run(&mut self, diag: &Handler) -> Result<(), Error>

Called after everything else to write out errors.

Loading content...

Implementors

impl FormatRenderer for Context[src]

Generates the documentation for crate into the directory dst

impl FormatRenderer for JsonRenderer[src]

Loading content...