Skip to content

Commit a790952

Browse files
committed
Pull out more types from html
1 parent 6a4396b commit a790952

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
@@ -70,7 +70,7 @@ use crate::doctree;
7070
use crate::error::Error;
7171
use crate::formats::cache::{cache, Cache};
7272
use crate::formats::item_type::ItemType;
73-
use crate::formats::{FormatRenderer, Impl};
73+
use crate::formats::{AssocItemRender, FormatRenderer, Impl, RenderMode};
7474
use crate::html::escape::Escape;
7575
use crate::html::format::fmt_impl_for_trait_page;
7676
use crate::html::format::Function;
@@ -626,7 +626,7 @@ impl FormatRenderer for Context {
626626
Ok(())
627627
}
628628

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

632632
// Go back to where we were at
@@ -3255,17 +3255,6 @@ impl<'a> AssocItemLink<'a> {
32553255
}
32563256
}
32573257

3258-
enum AssocItemRender<'a> {
3259-
All,
3260-
DerefFor { trait_: &'a clean::Type, type_: &'a clean::Type, deref_mut_: bool },
3261-
}
3262-
3263-
#[derive(Copy, Clone, PartialEq)]
3264-
enum RenderMode {
3265-
Normal,
3266-
ForDeref { mut_: bool },
3267-
}
3268-
32693258
fn render_assoc_items(
32703259
w: &mut Buffer,
32713260
cx: &Context,

0 commit comments

Comments
 (0)