Skip to content

Commit aa132ae

Browse files
committed
Pull out more types from html
1 parent f3f748e commit aa132ae

File tree

3 files changed

+16
-14
lines changed

3 files changed

+16
-14
lines changed

src/librustdoc/formats/mod.rs

Lines changed: 11 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -9,6 +9,17 @@ use rustc_span::def_id::DefId;
99
use crate::clean;
1010
use crate::clean::types::GetDefId;
1111

12+
pub enum AssocItemRender<'a> {
13+
All,
14+
DerefFor { trait_: &'a clean::Type, type_: &'a clean::Type, deref_mut_: bool },
15+
}
16+
17+
#[derive(Copy, Clone, PartialEq)]
18+
pub enum RenderMode {
19+
Normal,
20+
ForDeref { mut_: bool },
21+
}
22+
1223
/// Metadata about implementations for a type or trait.
1324
#[derive(Clone, Debug)]
1425
pub struct Impl {

src/librustdoc/formats/renderer.rs

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -10,6 +10,8 @@ use crate::formats::cache::{Cache, CACHE_KEY};
1010
pub trait FormatRenderer: Clone {
1111
type Output: FormatRenderer;
1212

13+
/// Sets up any state required for the emulator. When this is called the cache has already been
14+
/// populated.
1315
fn init(
1416
krate: clean::Crate,
1517
options: RenderOptions,
@@ -30,7 +32,7 @@ pub trait FormatRenderer: Clone {
3032
) -> Result<(), Error>;
3133

3234
/// Runs after recursively rendering all sub-items of a module.
33-
fn mod_item_out(&mut self, name: &str) -> Result<(), Error>;
35+
fn mod_item_out(&mut self, item_name: &str) -> Result<(), Error>;
3436

3537
/// Post processing hook for cleanup and dumping output to files.
3638
fn after_krate(&mut self, krate: &clean::Crate, cache: &Cache) -> Result<(), Error>;

src/librustdoc/html/render/mod.rs

Lines changed: 2 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -69,7 +69,7 @@ use crate::doctree;
6969
use crate::error::Error;
7070
use crate::formats::cache::{cache, Cache};
7171
use crate::formats::item_type::ItemType;
72-
use crate::formats::{FormatRenderer, Impl};
72+
use crate::formats::{AssocItemRender, FormatRenderer, Impl, RenderMode};
7373
use crate::html::escape::Escape;
7474
use crate::html::format::fmt_impl_for_trait_page;
7575
use crate::html::format::Function;
@@ -608,7 +608,7 @@ impl FormatRenderer for Context {
608608
Ok(())
609609
}
610610

611-
fn mod_item_out(&mut self, _name: &str) -> Result<(), Error> {
611+
fn mod_item_out(&mut self, _item_name: &str) -> Result<(), Error> {
612612
info!("Recursed; leaving {}", self.dst.display());
613613

614614
// Go back to where we were at
@@ -3266,17 +3266,6 @@ impl<'a> AssocItemLink<'a> {
32663266
}
32673267
}
32683268

3269-
enum AssocItemRender<'a> {
3270-
All,
3271-
DerefFor { trait_: &'a clean::Type, type_: &'a clean::Type, deref_mut_: bool },
3272-
}
3273-
3274-
#[derive(Copy, Clone, PartialEq)]
3275-
enum RenderMode {
3276-
Normal,
3277-
ForDeref { mut_: bool },
3278-
}
3279-
32803269
fn render_assoc_items(
32813270
w: &mut Buffer,
32823271
cx: &Context,

0 commit comments

Comments
 (0)