@@ -2259,8 +2259,8 @@ fn document(w: &mut fmt::Formatter, cx: &Context, item: &clean::Item) -> fmt::Re
22592259 if let Some ( ref name) = item. name {
22602260 info ! ( "Documenting {}" , name) ;
22612261 }
2262- document_stability ( w, cx, item) ?;
2263- document_full ( w, item, cx, "" ) ?;
2262+ document_stability ( w, cx, item, false ) ?;
2263+ document_full ( w, item, cx, "" , false ) ?;
22642264 Ok ( ( ) )
22652265}
22662266
@@ -2269,44 +2269,53 @@ fn render_markdown(w: &mut fmt::Formatter,
22692269 cx : & Context ,
22702270 md_text : & str ,
22712271 links : Vec < ( String , String ) > ,
2272- prefix : & str )
2272+ prefix : & str ,
2273+ is_hidden : bool )
22732274 -> fmt:: Result {
22742275 let mut ids = cx. id_map . borrow_mut ( ) ;
2275- write ! ( w, "<div class='docblock'>{}{}</div>" ,
2276- prefix, Markdown ( md_text, & links, RefCell :: new( & mut ids) , cx. codes) )
2276+ write ! ( w, "<div class='docblock{}'>{}{}</div>" ,
2277+ if is_hidden { " hidden" } else { "" } ,
2278+ prefix,
2279+ Markdown ( md_text, & links, RefCell :: new( & mut ids) ,
2280+ cx. codes) )
22772281}
22782282
22792283fn document_short ( w : & mut fmt:: Formatter , cx : & Context , item : & clean:: Item , link : AssocItemLink ,
2280- prefix : & str ) -> fmt:: Result {
2284+ prefix : & str , is_hidden : bool ) -> fmt:: Result {
22812285 if let Some ( s) = item. doc_value ( ) {
22822286 let markdown = if s. contains ( '\n' ) {
22832287 format ! ( "{} [Read more]({})" ,
22842288 & plain_summary_line( Some ( s) ) , naive_assoc_href( item, link) )
22852289 } else {
22862290 plain_summary_line ( Some ( s) ) . to_string ( )
22872291 } ;
2288- render_markdown ( w, cx, & markdown, item. links ( ) , prefix) ?;
2292+ render_markdown ( w, cx, & markdown, item. links ( ) , prefix, is_hidden ) ?;
22892293 } else if !prefix. is_empty ( ) {
2290- write ! ( w, "<div class='docblock'>{}</div>" , prefix) ?;
2294+ write ! ( w, "<div class='docblock{}'>{}</div>" ,
2295+ if is_hidden { " hidden" } else { "" } ,
2296+ prefix) ?;
22912297 }
22922298 Ok ( ( ) )
22932299}
22942300
22952301fn document_full ( w : & mut fmt:: Formatter , item : & clean:: Item ,
2296- cx : & Context , prefix : & str ) -> fmt:: Result {
2302+ cx : & Context , prefix : & str , is_hidden : bool ) -> fmt:: Result {
22972303 if let Some ( s) = cx. shared . maybe_collapsed_doc_value ( item) {
22982304 debug ! ( "Doc block: =====\n {}\n =====" , s) ;
2299- render_markdown ( w, cx, & * s, item. links ( ) , prefix) ?;
2305+ render_markdown ( w, cx, & * s, item. links ( ) , prefix, is_hidden ) ?;
23002306 } else if !prefix. is_empty ( ) {
2301- write ! ( w, "<div class='docblock'>{}</div>" , prefix) ?;
2307+ write ! ( w, "<div class='docblock{}'>{}</div>" ,
2308+ if is_hidden { " hidden" } else { "" } ,
2309+ prefix) ?;
23022310 }
23032311 Ok ( ( ) )
23042312}
23052313
2306- fn document_stability ( w : & mut fmt:: Formatter , cx : & Context , item : & clean:: Item ) -> fmt:: Result {
2314+ fn document_stability ( w : & mut fmt:: Formatter , cx : & Context , item : & clean:: Item ,
2315+ is_hidden : bool ) -> fmt:: Result {
23072316 let stabilities = short_stability ( item, cx, true ) ;
23082317 if !stabilities. is_empty ( ) {
2309- write ! ( w, "<div class='stability'>" ) ?;
2318+ write ! ( w, "<div class='stability{} '>" , if is_hidden { " hidden" } else { "" } ) ?;
23102319 for stability in stabilities {
23112320 write ! ( w, "{}" , stability) ?;
23122321 }
@@ -3872,6 +3881,11 @@ fn render_impl(w: &mut fmt::Formatter, cx: &Context, i: &Impl, link: AssocItemLi
38723881 RenderMode :: ForDeref { mut_ : deref_mut_ } => should_render_item ( & item, deref_mut_) ,
38733882 } ;
38743883
3884+ let ( mut is_hidden, extra_class) = if item. doc_value ( ) . is_some ( ) {
3885+ ( false , "" )
3886+ } else {
3887+ ( true , " hidden" )
3888+ } ;
38753889 match item. inner {
38763890 clean:: MethodItem ( clean:: Method { ref decl, .. } ) |
38773891 clean:: TyMethodItem ( clean:: TyMethod { ref decl, .. } ) => {
@@ -3896,20 +3910,21 @@ fn render_impl(w: &mut fmt::Formatter, cx: &Context, i: &Impl, link: AssocItemLi
38963910 render_stability_since_raw ( w, item. stable_since ( ) , outer_version) ?;
38973911 }
38983912 write ! ( w, "</td></tr></tbody></table></span></h4>" ) ?;
3913+ is_hidden = false ;
38993914 }
39003915 }
39013916 clean:: TypedefItem ( ref tydef, _) => {
39023917 let id = cx. derive_id ( format ! ( "{}.{}" , ItemType :: AssociatedType , name) ) ;
39033918 let ns_id = cx. derive_id ( format ! ( "{}.{}" , name, item_type. name_space( ) ) ) ;
3904- write ! ( w, "<h4 id='{}' class=\" {}\" >" , id, item_type) ?;
3919+ write ! ( w, "<h4 id='{}' class=\" {}{} \" >" , id, item_type, extra_class ) ?;
39053920 write ! ( w, "<span id='{}' class='invisible'><code>" , ns_id) ?;
39063921 assoc_type ( w, item, & Vec :: new ( ) , Some ( & tydef. type_ ) , link. anchor ( & id) ) ?;
39073922 write ! ( w, "</code></span></h4>\n " ) ?;
39083923 }
39093924 clean:: AssociatedConstItem ( ref ty, ref default) => {
39103925 let id = cx. derive_id ( format ! ( "{}.{}" , item_type, name) ) ;
39113926 let ns_id = cx. derive_id ( format ! ( "{}.{}" , name, item_type. name_space( ) ) ) ;
3912- write ! ( w, "<h4 id='{}' class=\" {}\" >" , id, item_type) ?;
3927+ write ! ( w, "<h4 id='{}' class=\" {}{} \" >" , id, item_type, extra_class ) ?;
39133928 write ! ( w, "<span id='{}' class='invisible'><code>" , ns_id) ?;
39143929 assoc_const ( w, item, ty, default. as_ref ( ) , link. anchor ( & id) ) ?;
39153930 let src = if let Some ( l) = ( Item { cx, item } ) . src_href ( ) {
@@ -3923,7 +3938,7 @@ fn render_impl(w: &mut fmt::Formatter, cx: &Context, i: &Impl, link: AssocItemLi
39233938 clean:: AssociatedTypeItem ( ref bounds, ref default) => {
39243939 let id = cx. derive_id ( format ! ( "{}.{}" , item_type, name) ) ;
39253940 let ns_id = cx. derive_id ( format ! ( "{}.{}" , name, item_type. name_space( ) ) ) ;
3926- write ! ( w, "<h4 id='{}' class=\" {}\" >" , id, item_type) ?;
3941+ write ! ( w, "<h4 id='{}' class=\" {}{} \" >" , id, item_type, extra_class ) ?;
39273942 write ! ( w, "<span id='{}' class='invisible'><code>" , ns_id) ?;
39283943 assoc_type ( w, item, bounds, default. as_ref ( ) , link. anchor ( & id) ) ?;
39293944 write ! ( w, "</code></span></h4>\n " ) ?;
@@ -3940,25 +3955,25 @@ fn render_impl(w: &mut fmt::Formatter, cx: &Context, i: &Impl, link: AssocItemLi
39403955 if let Some ( it) = t. items . iter ( ) . find ( |i| i. name == item. name ) {
39413956 // We need the stability of the item from the trait
39423957 // because impls can't have a stability.
3943- document_stability ( w, cx, it) ?;
3958+ document_stability ( w, cx, it, is_hidden ) ?;
39443959 if item. doc_value ( ) . is_some ( ) {
3945- document_full ( w, item, cx, "" ) ?;
3960+ document_full ( w, item, cx, "" , is_hidden ) ?;
39463961 } else if show_def_docs {
39473962 // In case the item isn't documented,
39483963 // provide short documentation from the trait.
3949- document_short ( w, cx, it, link, "" ) ?;
3964+ document_short ( w, cx, it, link, "" , is_hidden ) ?;
39503965 }
39513966 }
39523967 } else {
3953- document_stability ( w, cx, item) ?;
3968+ document_stability ( w, cx, item, is_hidden ) ?;
39543969 if show_def_docs {
3955- document_full ( w, item, cx, "" ) ?;
3970+ document_full ( w, item, cx, "" , is_hidden ) ?;
39563971 }
39573972 }
39583973 } else {
3959- document_stability ( w, cx, item) ?;
3974+ document_stability ( w, cx, item, is_hidden ) ?;
39603975 if show_def_docs {
3961- document_short ( w, cx, item, link, "" ) ?;
3976+ document_short ( w, cx, item, link, "" , is_hidden ) ?;
39623977 }
39633978 }
39643979 }
0 commit comments