use crate::clean;
use crate::clean::types::GetDefId;
+pub enum AssocItemRender<'a> {
+ All,
+ DerefFor { trait_: &'a clean::Type, type_: &'a clean::Type, deref_mut_: bool },
+}
+
+#[derive(Copy, Clone, PartialEq)]
+pub enum RenderMode {
+ Normal,
+ ForDeref { mut_: bool },
+}
+
/// Metadata about implementations for a type or trait.
#[derive(Clone, Debug)]
pub struct Impl {
pub trait FormatRenderer: Clone {
type Output: FormatRenderer;
+ /// Sets up any state required for the emulator. When this is called the cache has already been
+ /// populated.
fn init(
krate: clean::Crate,
options: RenderOptions,
) -> Result<(), Error>;
/// Runs after recursively rendering all sub-items of a module.
- fn mod_item_out(&mut self, name: &str) -> Result<(), Error>;
+ fn mod_item_out(&mut self, item_name: &str) -> Result<(), Error>;
/// Post processing hook for cleanup and dumping output to files.
fn after_krate(&mut self, krate: &clean::Crate, cache: &Cache) -> Result<(), Error>;
use crate::error::Error;
use crate::formats::cache::{cache, Cache};
use crate::formats::item_type::ItemType;
-use crate::formats::{FormatRenderer, Impl};
+use crate::formats::{AssocItemRender, FormatRenderer, Impl, RenderMode};
use crate::html::escape::Escape;
use crate::html::format::fmt_impl_for_trait_page;
use crate::html::format::Function;
Ok(())
}
- fn mod_item_out(&mut self, _name: &str) -> Result<(), Error> {
+ fn mod_item_out(&mut self, _item_name: &str) -> Result<(), Error> {
info!("Recursed; leaving {}", self.dst.display());
// Go back to where we were at
}
}
-enum AssocItemRender<'a> {
- All,
- DerefFor { trait_: &'a clean::Type, type_: &'a clean::Type, deref_mut_: bool },
-}
-
-#[derive(Copy, Clone, PartialEq)]
-enum RenderMode {
- Normal,
- ForDeref { mut_: bool },
-}
-
fn render_assoc_items(
w: &mut Buffer,
cx: &Context,