]> git.lizzy.rs Git - rust.git/blob - src/librustdoc/formats/mod.rs
2473f7758d2a82e456d774f03d8de83bdd600ffe
[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 /// Metadata about implementations for a type or trait.
13 #[derive(Clone, Debug)]
14 pub struct Impl {
15     pub impl_item: clean::Item,
16 }
17
18 impl Impl {
19     pub fn inner_impl(&self) -> &clean::Impl {
20         match self.impl_item.inner {
21             clean::ImplItem(ref impl_) => impl_,
22             _ => panic!("non-impl item found in impl"),
23         }
24     }
25
26     pub fn trait_did(&self) -> Option<DefId> {
27         self.inner_impl().trait_.def_id()
28     }
29 }