@@ -2259,8 +2259,8 @@ fn document(w: &mut fmt::Formatter, cx: &Context, item: &clean::Item) -> fmt::Re
2259
2259
if let Some ( ref name) = item. name {
2260
2260
info ! ( "Documenting {}" , name) ;
2261
2261
}
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 ) ?;
2264
2264
Ok ( ( ) )
2265
2265
}
2266
2266
@@ -2269,44 +2269,53 @@ fn render_markdown(w: &mut fmt::Formatter,
2269
2269
cx : & Context ,
2270
2270
md_text : & str ,
2271
2271
links : Vec < ( String , String ) > ,
2272
- prefix : & str )
2272
+ prefix : & str ,
2273
+ is_hidden : bool )
2273
2274
-> fmt:: Result {
2274
2275
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) )
2277
2281
}
2278
2282
2279
2283
fn 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 {
2281
2285
if let Some ( s) = item. doc_value ( ) {
2282
2286
let markdown = if s. contains ( '\n' ) {
2283
2287
format ! ( "{} [Read more]({})" ,
2284
2288
& plain_summary_line( Some ( s) ) , naive_assoc_href( item, link) )
2285
2289
} else {
2286
2290
plain_summary_line ( Some ( s) ) . to_string ( )
2287
2291
} ;
2288
- render_markdown ( w, cx, & markdown, item. links ( ) , prefix) ?;
2292
+ render_markdown ( w, cx, & markdown, item. links ( ) , prefix, is_hidden ) ?;
2289
2293
} 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) ?;
2291
2297
}
2292
2298
Ok ( ( ) )
2293
2299
}
2294
2300
2295
2301
fn 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 {
2297
2303
if let Some ( s) = cx. shared . maybe_collapsed_doc_value ( item) {
2298
2304
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 ) ?;
2300
2306
} 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) ?;
2302
2310
}
2303
2311
Ok ( ( ) )
2304
2312
}
2305
2313
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 {
2307
2316
let stabilities = short_stability ( item, cx, true ) ;
2308
2317
if !stabilities. is_empty ( ) {
2309
- write ! ( w, "<div class='stability'>" ) ?;
2318
+ write ! ( w, "<div class='stability{} '>" , if is_hidden { " hidden" } else { "" } ) ?;
2310
2319
for stability in stabilities {
2311
2320
write ! ( w, "{}" , stability) ?;
2312
2321
}
@@ -3872,6 +3881,11 @@ fn render_impl(w: &mut fmt::Formatter, cx: &Context, i: &Impl, link: AssocItemLi
3872
3881
RenderMode :: ForDeref { mut_ : deref_mut_ } => should_render_item ( & item, deref_mut_) ,
3873
3882
} ;
3874
3883
3884
+ let ( mut is_hidden, extra_class) = if item. doc_value ( ) . is_some ( ) {
3885
+ ( false , "" )
3886
+ } else {
3887
+ ( true , " hidden" )
3888
+ } ;
3875
3889
match item. inner {
3876
3890
clean:: MethodItem ( clean:: Method { ref decl, .. } ) |
3877
3891
clean:: TyMethodItem ( clean:: TyMethod { ref decl, .. } ) => {
@@ -3896,20 +3910,21 @@ fn render_impl(w: &mut fmt::Formatter, cx: &Context, i: &Impl, link: AssocItemLi
3896
3910
render_stability_since_raw ( w, item. stable_since ( ) , outer_version) ?;
3897
3911
}
3898
3912
write ! ( w, "</td></tr></tbody></table></span></h4>" ) ?;
3913
+ is_hidden = false ;
3899
3914
}
3900
3915
}
3901
3916
clean:: TypedefItem ( ref tydef, _) => {
3902
3917
let id = cx. derive_id ( format ! ( "{}.{}" , ItemType :: AssociatedType , name) ) ;
3903
3918
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 ) ?;
3905
3920
write ! ( w, "<span id='{}' class='invisible'><code>" , ns_id) ?;
3906
3921
assoc_type ( w, item, & Vec :: new ( ) , Some ( & tydef. type_ ) , link. anchor ( & id) ) ?;
3907
3922
write ! ( w, "</code></span></h4>\n " ) ?;
3908
3923
}
3909
3924
clean:: AssociatedConstItem ( ref ty, ref default) => {
3910
3925
let id = cx. derive_id ( format ! ( "{}.{}" , item_type, name) ) ;
3911
3926
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 ) ?;
3913
3928
write ! ( w, "<span id='{}' class='invisible'><code>" , ns_id) ?;
3914
3929
assoc_const ( w, item, ty, default. as_ref ( ) , link. anchor ( & id) ) ?;
3915
3930
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
3923
3938
clean:: AssociatedTypeItem ( ref bounds, ref default) => {
3924
3939
let id = cx. derive_id ( format ! ( "{}.{}" , item_type, name) ) ;
3925
3940
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 ) ?;
3927
3942
write ! ( w, "<span id='{}' class='invisible'><code>" , ns_id) ?;
3928
3943
assoc_type ( w, item, bounds, default. as_ref ( ) , link. anchor ( & id) ) ?;
3929
3944
write ! ( w, "</code></span></h4>\n " ) ?;
@@ -3940,25 +3955,25 @@ fn render_impl(w: &mut fmt::Formatter, cx: &Context, i: &Impl, link: AssocItemLi
3940
3955
if let Some ( it) = t. items . iter ( ) . find ( |i| i. name == item. name ) {
3941
3956
// We need the stability of the item from the trait
3942
3957
// because impls can't have a stability.
3943
- document_stability ( w, cx, it) ?;
3958
+ document_stability ( w, cx, it, is_hidden ) ?;
3944
3959
if item. doc_value ( ) . is_some ( ) {
3945
- document_full ( w, item, cx, "" ) ?;
3960
+ document_full ( w, item, cx, "" , is_hidden ) ?;
3946
3961
} else if show_def_docs {
3947
3962
// In case the item isn't documented,
3948
3963
// provide short documentation from the trait.
3949
- document_short ( w, cx, it, link, "" ) ?;
3964
+ document_short ( w, cx, it, link, "" , is_hidden ) ?;
3950
3965
}
3951
3966
}
3952
3967
} else {
3953
- document_stability ( w, cx, item) ?;
3968
+ document_stability ( w, cx, item, is_hidden ) ?;
3954
3969
if show_def_docs {
3955
- document_full ( w, item, cx, "" ) ?;
3970
+ document_full ( w, item, cx, "" , is_hidden ) ?;
3956
3971
}
3957
3972
}
3958
3973
} else {
3959
- document_stability ( w, cx, item) ?;
3974
+ document_stability ( w, cx, item, is_hidden ) ?;
3960
3975
if show_def_docs {
3961
- document_short ( w, cx, item, link, "" ) ?;
3976
+ document_short ( w, cx, item, link, "" , is_hidden ) ?;
3962
3977
}
3963
3978
}
3964
3979
}
0 commit comments