1313//! is cloned per-thread and contains information about what is currently being
1414//! rendered.
1515//!
16+ //! The main entry point to the rendering system is the implementation of
17+ //! `FormatRenderer` on `Context`.
18+ //!
1619//! In order to speed up rendering (mostly because of markdown rendering), the
1720//! rendering process has been parallelized. This parallelization is only
1821//! 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 {
9093/// Specifies whether rendering directly implemented trait items or ones from a certain Deref
9194/// impl.
9295#[ derive( Copy , Clone , Debug ) ]
93- pub ( crate ) enum AssocItemRender < ' a > {
96+ enum AssocItemRender < ' a > {
9497 All ,
9598 DerefFor { trait_ : & ' a clean:: Path , type_ : & ' a clean:: Type , deref_mut_ : bool } ,
9699}
97100
98101/// For different handling of associated items from the Deref target of a type rather than the type
99102/// itself.
100103#[ derive( Copy , Clone , PartialEq ) ]
101- pub ( crate ) enum RenderMode {
104+ enum RenderMode {
102105 Normal ,
103106 ForDeref { mut_ : bool } ,
104107}
@@ -126,7 +129,7 @@ pub(crate) struct IndexItem {
126129
127130/// A type used for the search index.
128131#[ derive( Debug , Eq , PartialEq ) ]
129- pub ( crate ) struct RenderType {
132+ struct RenderType {
130133 id : Option < RenderTypeId > ,
131134 generics : Option < Vec < RenderType > > ,
132135 bindings : Option < Vec < ( RenderTypeId , Vec < RenderType > ) > > ,
@@ -137,7 +140,7 @@ impl RenderType {
137140 // The contents of the lists are always integers in self-terminating hex
138141 // form, handled by `RenderTypeId::write_to_string`, so no commas are
139142 // needed to separate the items.
140- pub fn write_to_string ( & self , string : & mut String ) {
143+ fn write_to_string ( & self , string : & mut String ) {
141144 fn write_optional_id ( id : Option < RenderTypeId > , string : & mut String ) {
142145 // 0 is a sentinel, everything else is one-indexed
143146 match id {
@@ -177,7 +180,7 @@ impl RenderType {
177180}
178181
179182#[ derive( Clone , Copy , Debug , Eq , PartialEq ) ]
180- pub ( crate ) enum RenderTypeId {
183+ enum RenderTypeId {
181184 DefId ( DefId ) ,
182185 Primitive ( clean:: PrimitiveType ) ,
183186 AssociatedType ( Symbol ) ,
@@ -186,7 +189,7 @@ pub(crate) enum RenderTypeId {
186189}
187190
188191impl RenderTypeId {
189- pub fn write_to_string ( & self , string : & mut String ) {
192+ fn write_to_string ( & self , string : & mut String ) {
190193 let id: i32 = match & self {
191194 // 0 is a sentinel, everything else is one-indexed
192195 // concrete type
@@ -209,7 +212,7 @@ pub(crate) struct IndexItemFunctionType {
209212}
210213
211214impl IndexItemFunctionType {
212- pub fn write_to_string < ' a > (
215+ fn write_to_string < ' a > (
213216 & ' a self ,
214217 string : & mut String ,
215218 backref_queue : & mut VecDeque < & ' a IndexItemFunctionType > ,
@@ -309,7 +312,7 @@ impl ItemEntry {
309312}
310313
311314impl ItemEntry {
312- pub ( crate ) fn print ( & self ) -> impl fmt:: Display {
315+ fn print ( & self ) -> impl fmt:: Display {
313316 fmt:: from_fn ( move |f| write ! ( f, "<a href=\" {}\" >{}</a>" , self . url, Escape ( & self . name) ) )
314317 }
315318}
@@ -760,7 +763,7 @@ fn short_item_info(
760763
761764// Render the list of items inside one of the sections "Trait Implementations",
762765// "Auto Trait Implementations," "Blanket Trait Implementations" (on struct/enum pages).
763- pub ( crate ) fn render_impls (
766+ fn render_impls (
764767 cx : & Context < ' _ > ,
765768 mut w : impl Write ,
766769 impls : & [ & Impl ] ,
@@ -1201,7 +1204,7 @@ impl<'a> AssocItemLink<'a> {
12011204 }
12021205}
12031206
1204- pub fn write_section_heading (
1207+ fn write_section_heading (
12051208 title : & str ,
12061209 id : & str ,
12071210 extra_class : Option < & str > ,
@@ -1226,7 +1229,7 @@ fn write_impl_section_heading(title: &str, id: &str) -> impl fmt::Display {
12261229 write_section_heading ( title, id, None , "" )
12271230}
12281231
1229- pub ( crate ) fn render_all_impls (
1232+ fn render_all_impls (
12301233 mut w : impl Write ,
12311234 cx : & Context < ' _ > ,
12321235 containing_item : & clean:: Item ,
@@ -1473,10 +1476,7 @@ fn should_render_item(item: &clean::Item, deref_mut_: bool, tcx: TyCtxt<'_>) ->
14731476 }
14741477}
14751478
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 > {
14801480 if ty. is_unit ( ) {
14811481 // Very common fast path.
14821482 return None ;
@@ -1588,10 +1588,7 @@ fn notable_traits_decl(ty: &clean::Type, cx: &Context<'_>) -> (String, String) {
15881588 ( format ! ( "{:#}" , ty. print( cx) ) , out)
15891589}
15901590
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 {
15951592 let mut mp: Vec < ( String , String ) > = tys. map ( |ty| notable_traits_decl ( ty, cx) ) . collect ( ) ;
15961593 mp. sort_by ( |( name1, _html1) , ( name2, _html2) | name1. cmp ( name2) ) ;
15971594 struct NotableTraitsMap ( Vec < ( String , String ) > ) ;
@@ -2171,7 +2168,7 @@ fn render_rightside(
21712168 } )
21722169}
21732170
2174- pub ( crate ) fn render_impl_summary (
2171+ fn render_impl_summary (
21752172 cx : & Context < ' _ > ,
21762173 i : & Impl ,
21772174 parent : & clean:: Item ,
0 commit comments