1 crate mod cache; 2 crate mod item_type; 3 crate mod renderer; 4 5 use rustc_hir::def_id::DefId; 6 7 crate use renderer::{run_format, FormatRenderer}; 8 9 use crate::clean; 10 11 /// Specifies whether rendering directly implemented trait items or ones from a certain Deref 12 /// impl. 13 crate enum AssocItemRender<'a> { 14 All, 15 DerefFor { trait_: &'a clean::Path, type_: &'a clean::Type, deref_mut_: bool }, 16 } 17 18 /// For different handling of associated items from the Deref target of a type rather than the type 19 /// itself. 20 #[derive(Copy, Clone, PartialEq)] 21 crate enum RenderMode { 22 Normal, 23 ForDeref { mut_: bool }, 24 } 25 26 /// Metadata about implementations for a type or trait. 27 #[derive(Clone, Debug)] 28 crate struct Impl { 29 crate impl_item: clean::Item, 30 } 31 32 impl Impl { inner_impl(&self) -> &clean::Impl33 crate fn inner_impl(&self) -> &clean::Impl { 34 match *self.impl_item.kind { 35 clean::ImplItem(ref impl_) => impl_, 36 _ => panic!("non-impl item found in impl"), 37 } 38 } 39 trait_did(&self) -> Option<DefId>40 crate fn trait_did(&self) -> Option<DefId> { 41 self.inner_impl().trait_.as_ref().map(|t| t.def_id()) 42 } 43 } 44