@@ -712,7 +712,9 @@ fn render_impls(
712712 None ,
713713 false ,
714714 true ,
715+ true ,
715716 & [ ] ,
717+ true ,
716718 ) ;
717719 buffer. into_inner ( )
718720 } )
@@ -1051,7 +1053,9 @@ fn render_assoc_items(
10511053 None ,
10521054 false ,
10531055 true ,
1056+ true ,
10541057 & [ ] ,
1058+ true ,
10551059 ) ;
10561060 }
10571061 }
@@ -1251,9 +1255,12 @@ fn render_impl(
12511255 use_absolute : Option < bool > ,
12521256 is_on_foreign_type : bool ,
12531257 show_default_items : bool ,
1258+ // It'll exclude methods.
1259+ show_non_assoc_items : bool ,
12541260 // This argument is used to reference same type with different paths to avoid duplication
12551261 // in documentation pages for trait with automatic implementations like "Send" and "Sync".
12561262 aliases : & [ String ] ,
1263+ toggle_open_by_default : bool ,
12571264) {
12581265 let cache = cx. cache ( ) ;
12591266 let traits = & cache. traits ;
@@ -1277,16 +1284,18 @@ fn render_impl(
12771284 is_default_item : bool ,
12781285 trait_ : Option < & clean:: Trait > ,
12791286 show_def_docs : bool ,
1287+ show_non_assoc_items : bool ,
12801288 ) {
12811289 let item_type = item. type_ ( ) ;
12821290 let name = item. name . as_ref ( ) . unwrap ( ) ;
12831291
1284- let render_method_item = match render_mode {
1285- RenderMode :: Normal => true ,
1286- RenderMode :: ForDeref { mut_ : deref_mut_ } => {
1287- should_render_item ( & item, deref_mut_, & cx. cache )
1288- }
1289- } ;
1292+ let render_method_item = show_non_assoc_items
1293+ && match render_mode {
1294+ RenderMode :: Normal => true ,
1295+ RenderMode :: ForDeref { mut_ : deref_mut_ } => {
1296+ should_render_item ( & item, deref_mut_, & cx. cache )
1297+ }
1298+ } ;
12901299
12911300 let in_trait_class = if trait_. is_some ( ) { " trait-impl" } else { "" } ;
12921301
@@ -1453,6 +1462,7 @@ fn render_impl(
14531462 false ,
14541463 trait_. map ( |t| & t. trait_ ) ,
14551464 show_def_docs,
1465+ show_non_assoc_items,
14561466 ) ;
14571467 }
14581468
@@ -1466,6 +1476,7 @@ fn render_impl(
14661476 containing_item : & clean:: Item ,
14671477 render_mode : RenderMode ,
14681478 show_def_docs : bool ,
1479+ show_non_assoc_items : bool ,
14691480 ) {
14701481 for trait_item in & t. items {
14711482 let n = trait_item. name ;
@@ -1488,6 +1499,7 @@ fn render_impl(
14881499 true ,
14891500 Some ( t) ,
14901501 show_def_docs,
1502+ show_non_assoc_items,
14911503 ) ;
14921504 }
14931505 }
@@ -1508,14 +1520,19 @@ fn render_impl(
15081520 parent,
15091521 render_mode,
15101522 show_def_docs,
1523+ show_non_assoc_items,
15111524 ) ;
15121525 }
15131526 }
15141527 if render_mode == RenderMode :: Normal {
15151528 let toggled = !( impl_items. is_empty ( ) && default_impl_items. is_empty ( ) ) ;
15161529 if toggled {
15171530 close_tags. insert_str ( 0 , "</details>" ) ;
1518- write ! ( w, "<details class=\" rustdoc-toggle implementors-toggle\" open>" ) ;
1531+ write ! (
1532+ w,
1533+ "<details class=\" rustdoc-toggle implementors-toggle\" {}>" ,
1534+ if toggle_open_by_default { " open" } else { "" }
1535+ ) ;
15191536 write ! ( w, "<summary>" )
15201537 }
15211538 render_impl_summary (
0 commit comments