]> git.lizzy.rs Git - rust.git/commitdiff
Pull out more types from html
authorJoseph Ryan <josephryan3.14@gmail.com>
Fri, 26 Jun 2020 13:18:20 +0000 (08:18 -0500)
committerJoseph Ryan <josephryan3.14@gmail.com>
Mon, 27 Jul 2020 21:00:38 +0000 (16:00 -0500)
src/librustdoc/formats/mod.rs
src/librustdoc/formats/renderer.rs
src/librustdoc/html/render/mod.rs

index 2473f7758d2a82e456d774f03d8de83bdd600ffe..97e1af13b8a56fa6ab63a95fe51dc80e5d90601c 100644 (file)
@@ -9,6 +9,17 @@
 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 {
index f1862337ba1a5b08180fc36c4067b2ca3449457b..d4ba6726cd22a44f8f7bd7d8c5aaa31393f0d30d 100644 (file)
@@ -10,6 +10,8 @@
 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,
@@ -30,7 +32,7 @@ fn mod_item_in(
     ) -> 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>;
index 1678cff16a96ef93e2f2a6c303294c5c2d2029e2..7140cf00b6e9375fa6532fe9524dbaf583bfefdc 100644 (file)
@@ -70,7 +70,7 @@
 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;
@@ -626,7 +626,7 @@ fn mod_item_in(
         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
@@ -3255,17 +3255,6 @@ fn anchor(&self, id: &'a String) -> Self {
     }
 }
 
-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,