]> git.lizzy.rs Git - rust.git/blob - src/librustdoc/formats/mod.rs
97e1af13b8a56fa6ab63a95fe51dc80e5d90601c
[rust.git] / src / librustdoc / formats / mod.rs
1 pub mod cache;
2 pub mod item_type;
3 pub mod renderer;
4
5 pub use renderer::{FormatRenderer, Renderer};
6
7 use rustc_span::def_id::DefId;
8
9 use crate::clean;
10 use crate::clean::types::GetDefId;
11
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
23 /// Metadata about implementations for a type or trait.
24 #[derive(Clone, Debug)]
25 pub struct Impl {
26     pub impl_item: clean::Item,
27 }
28
29 impl Impl {
30     pub fn inner_impl(&self) -> &clean::Impl {
31         match self.impl_item.inner {
32             clean::ImplItem(ref impl_) => impl_,
33             _ => panic!("non-impl item found in impl"),
34         }
35     }
36
37     pub fn trait_did(&self) -> Option<DefId> {
38         self.inner_impl().trait_.def_id()
39     }
40 }