13
13
//! is cloned per-thread and contains information about what is currently being
14
14
//! rendered.
15
15
//!
16
+ //! The main entry point to the rendering system is the implementation of
17
+ //! `FormatRenderer` on `Context`.
18
+ //!
16
19
//! In order to speed up rendering (mostly because of markdown rendering), the
17
20
//! rendering process has been parallelized. This parallelization is only
18
21
//! exposed through the `crate` method on the context, and then also from the
@@ -90,15 +93,15 @@ pub(crate) fn ensure_trailing_slash(v: &str) -> impl fmt::Display {
90
93
/// Specifies whether rendering directly implemented trait items or ones from a certain Deref
91
94
/// impl.
92
95
#[ derive( Copy , Clone , Debug ) ]
93
- pub ( crate ) enum AssocItemRender < ' a > {
96
+ enum AssocItemRender < ' a > {
94
97
All ,
95
98
DerefFor { trait_ : & ' a clean:: Path , type_ : & ' a clean:: Type , deref_mut_ : bool } ,
96
99
}
97
100
98
101
/// For different handling of associated items from the Deref target of a type rather than the type
99
102
/// itself.
100
103
#[ derive( Copy , Clone , PartialEq ) ]
101
- pub ( crate ) enum RenderMode {
104
+ enum RenderMode {
102
105
Normal ,
103
106
ForDeref { mut_ : bool } ,
104
107
}
@@ -126,7 +129,7 @@ pub(crate) struct IndexItem {
126
129
127
130
/// A type used for the search index.
128
131
#[ derive( Debug , Eq , PartialEq ) ]
129
- pub ( crate ) struct RenderType {
132
+ struct RenderType {
130
133
id : Option < RenderTypeId > ,
131
134
generics : Option < Vec < RenderType > > ,
132
135
bindings : Option < Vec < ( RenderTypeId , Vec < RenderType > ) > > ,
@@ -137,7 +140,7 @@ impl RenderType {
137
140
// The contents of the lists are always integers in self-terminating hex
138
141
// form, handled by `RenderTypeId::write_to_string`, so no commas are
139
142
// needed to separate the items.
140
- pub fn write_to_string ( & self , string : & mut String ) {
143
+ fn write_to_string ( & self , string : & mut String ) {
141
144
fn write_optional_id ( id : Option < RenderTypeId > , string : & mut String ) {
142
145
// 0 is a sentinel, everything else is one-indexed
143
146
match id {
@@ -177,7 +180,7 @@ impl RenderType {
177
180
}
178
181
179
182
#[ derive( Clone , Copy , Debug , Eq , PartialEq ) ]
180
- pub ( crate ) enum RenderTypeId {
183
+ enum RenderTypeId {
181
184
DefId ( DefId ) ,
182
185
Primitive ( clean:: PrimitiveType ) ,
183
186
AssociatedType ( Symbol ) ,
@@ -186,7 +189,7 @@ pub(crate) enum RenderTypeId {
186
189
}
187
190
188
191
impl RenderTypeId {
189
- pub fn write_to_string ( & self , string : & mut String ) {
192
+ fn write_to_string ( & self , string : & mut String ) {
190
193
let id: i32 = match & self {
191
194
// 0 is a sentinel, everything else is one-indexed
192
195
// concrete type
@@ -209,7 +212,7 @@ pub(crate) struct IndexItemFunctionType {
209
212
}
210
213
211
214
impl IndexItemFunctionType {
212
- pub fn write_to_string < ' a > (
215
+ fn write_to_string < ' a > (
213
216
& ' a self ,
214
217
string : & mut String ,
215
218
backref_queue : & mut VecDeque < & ' a IndexItemFunctionType > ,
@@ -309,7 +312,7 @@ impl ItemEntry {
309
312
}
310
313
311
314
impl ItemEntry {
312
- pub ( crate ) fn print ( & self ) -> impl fmt:: Display {
315
+ fn print ( & self ) -> impl fmt:: Display {
313
316
fmt:: from_fn ( move |f| write ! ( f, "<a href=\" {}\" >{}</a>" , self . url, Escape ( & self . name) ) )
314
317
}
315
318
}
@@ -760,7 +763,7 @@ fn short_item_info(
760
763
761
764
// Render the list of items inside one of the sections "Trait Implementations",
762
765
// "Auto Trait Implementations," "Blanket Trait Implementations" (on struct/enum pages).
763
- pub ( crate ) fn render_impls (
766
+ fn render_impls (
764
767
cx : & Context < ' _ > ,
765
768
mut w : impl Write ,
766
769
impls : & [ & Impl ] ,
@@ -1201,7 +1204,7 @@ impl<'a> AssocItemLink<'a> {
1201
1204
}
1202
1205
}
1203
1206
1204
- pub fn write_section_heading (
1207
+ fn write_section_heading (
1205
1208
title : & str ,
1206
1209
id : & str ,
1207
1210
extra_class : Option < & str > ,
@@ -1226,7 +1229,7 @@ fn write_impl_section_heading(title: &str, id: &str) -> impl fmt::Display {
1226
1229
write_section_heading ( title, id, None , "" )
1227
1230
}
1228
1231
1229
- pub ( crate ) fn render_all_impls (
1232
+ fn render_all_impls (
1230
1233
mut w : impl Write ,
1231
1234
cx : & Context < ' _ > ,
1232
1235
containing_item : & clean:: Item ,
@@ -1473,10 +1476,7 @@ fn should_render_item(item: &clean::Item, deref_mut_: bool, tcx: TyCtxt<'_>) ->
1473
1476
}
1474
1477
}
1475
1478
1476
- pub ( crate ) fn notable_traits_button (
1477
- ty : & clean:: Type ,
1478
- cx : & Context < ' _ > ,
1479
- ) -> Option < impl fmt:: Display > {
1479
+ fn notable_traits_button ( ty : & clean:: Type , cx : & Context < ' _ > ) -> Option < impl fmt:: Display > {
1480
1480
if ty. is_unit ( ) {
1481
1481
// Very common fast path.
1482
1482
return None ;
@@ -1588,10 +1588,7 @@ fn notable_traits_decl(ty: &clean::Type, cx: &Context<'_>) -> (String, String) {
1588
1588
( format ! ( "{:#}" , ty. print( cx) ) , out)
1589
1589
}
1590
1590
1591
- pub ( crate ) fn notable_traits_json < ' a > (
1592
- tys : impl Iterator < Item = & ' a clean:: Type > ,
1593
- cx : & Context < ' _ > ,
1594
- ) -> String {
1591
+ fn notable_traits_json < ' a > ( tys : impl Iterator < Item = & ' a clean:: Type > , cx : & Context < ' _ > ) -> String {
1595
1592
let mut mp: Vec < ( String , String ) > = tys. map ( |ty| notable_traits_decl ( ty, cx) ) . collect ( ) ;
1596
1593
mp. sort_by ( |( name1, _html1) , ( name2, _html2) | name1. cmp ( name2) ) ;
1597
1594
struct NotableTraitsMap ( Vec < ( String , String ) > ) ;
@@ -2171,7 +2168,7 @@ fn render_rightside(
2171
2168
} )
2172
2169
}
2173
2170
2174
- pub ( crate ) fn render_impl_summary (
2171
+ fn render_impl_summary (
2175
2172
cx : & Context < ' _ > ,
2176
2173
i : & Impl ,
2177
2174
parent : & clean:: Item ,
0 commit comments