about summary refs log tree commit diff
path: root/src/librustdoc/formats/mod.rs
blob: 2473f7758d2a82e456d774f03d8de83bdd600ffe (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
pub mod cache;
pub mod item_type;
pub mod renderer;

pub use renderer::{FormatRenderer, Renderer};

use rustc_span::def_id::DefId;

use crate::clean;
use crate::clean::types::GetDefId;

/// Metadata about implementations for a type or trait.
#[derive(Clone, Debug)]
pub struct Impl {
    pub impl_item: clean::Item,
}

impl Impl {
    pub fn inner_impl(&self) -> &clean::Impl {
        match self.impl_item.inner {
            clean::ImplItem(ref impl_) => impl_,
            _ => panic!("non-impl item found in impl"),
        }
    }

    pub fn trait_did(&self) -> Option<DefId> {
        self.inner_impl().trait_.def_id()
    }
}