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