@@ -2141,7 +2141,9 @@ fn item_trait(w: &mut fmt::Formatter, cx: &Context, it: &clean::Item,
2141
2141
2142
2142
if !types. is_empty ( ) {
2143
2143
write ! ( w, "
2144
- <h2 id='associated-types'>Associated Types</h2>
2144
+ <h2 id='associated-types' class='section-header'>
2145
+ <a href='#associated-types'>Associated Types</a>
2146
+ </h2>
2145
2147
<div class='methods'>
2146
2148
" ) ?;
2147
2149
for t in & types {
@@ -2152,7 +2154,9 @@ fn item_trait(w: &mut fmt::Formatter, cx: &Context, it: &clean::Item,
2152
2154
2153
2155
if !consts. is_empty ( ) {
2154
2156
write ! ( w, "
2155
- <h2 id='associated-const'>Associated Constants</h2>
2157
+ <h2 id='associated-const' class='section-header'>
2158
+ <a href='#associated-const'>Associated Constants</a>
2159
+ </h2>
2156
2160
<div class='methods'>
2157
2161
" ) ?;
2158
2162
for t in & consts {
@@ -2164,7 +2168,9 @@ fn item_trait(w: &mut fmt::Formatter, cx: &Context, it: &clean::Item,
2164
2168
// Output the documentation for each function individually
2165
2169
if !required. is_empty ( ) {
2166
2170
write ! ( w, "
2167
- <h2 id='required-methods'>Required Methods</h2>
2171
+ <h2 id='required-methods' class='section-header'>
2172
+ <a href='#required-methods'>Required Methods</a>
2173
+ </h2>
2168
2174
<div class='methods'>
2169
2175
" ) ?;
2170
2176
for m in & required {
@@ -2174,7 +2180,9 @@ fn item_trait(w: &mut fmt::Formatter, cx: &Context, it: &clean::Item,
2174
2180
}
2175
2181
if !provided. is_empty ( ) {
2176
2182
write ! ( w, "
2177
- <h2 id='provided-methods'>Provided Methods</h2>
2183
+ <h2 id='provided-methods' class='section-header'>
2184
+ <a href='#provided-methods'>Provided Methods</a>
2185
+ </h2>
2178
2186
<div class='methods'>
2179
2187
" ) ?;
2180
2188
for m in & provided {
@@ -2188,7 +2196,9 @@ fn item_trait(w: &mut fmt::Formatter, cx: &Context, it: &clean::Item,
2188
2196
2189
2197
let cache = cache ( ) ;
2190
2198
write ! ( w, "
2191
- <h2 id='implementors'>Implementors</h2>
2199
+ <h2 id='implementors' class='section-header'>
2200
+ <a href='#implementors'>Implementors</a>
2201
+ </h2>
2192
2202
<ul class='item-list' id='implementors-list'>
2193
2203
" ) ?;
2194
2204
if let Some ( implementors) = cache. implementors . get ( & it. def_id ) {
@@ -2419,7 +2429,8 @@ fn item_struct(w: &mut fmt::Formatter, cx: &Context, it: &clean::Item,
2419
2429
} ) . peekable ( ) ;
2420
2430
if let doctree:: Plain = s. struct_type {
2421
2431
if fields. peek ( ) . is_some ( ) {
2422
- write ! ( w, "<h2 id='fields' class='fields'>Fields</h2>" ) ?;
2432
+ write ! ( w, "<h2 id='fields' class='fields section-header'>
2433
+ <a href='#fields'>Fields</a></h2>" ) ?;
2423
2434
for ( field, ty) in fields {
2424
2435
let id = derive_id ( format ! ( "{}.{}" ,
2425
2436
ItemType :: StructField ,
@@ -2467,7 +2478,8 @@ fn item_union(w: &mut fmt::Formatter, cx: &Context, it: &clean::Item,
2467
2478
}
2468
2479
} ) . peekable ( ) ;
2469
2480
if fields. peek ( ) . is_some ( ) {
2470
- write ! ( w, "<h2 id='fields' class='fields'>Fields</h2>" ) ?;
2481
+ write ! ( w, "<h2 id='fields' class='fields section-header'>
2482
+ <a href='#fields'>Fields</a></h2>" ) ?;
2471
2483
for ( field, ty) in fields {
2472
2484
write ! ( w, "<span id='{shortty}.{name}' class=\" {shortty}\" ><code>{name}: {ty}</code>
2473
2485
</span>" ,
@@ -2539,7 +2551,8 @@ fn item_enum(w: &mut fmt::Formatter, cx: &Context, it: &clean::Item,
2539
2551
2540
2552
document ( w, cx, it) ?;
2541
2553
if !e. variants . is_empty ( ) {
2542
- write ! ( w, "<h2 id='variants' class='variants'>Variants</h2>\n " ) ?;
2554
+ write ! ( w, "<h2 id='variants' class='variants section-header'>
2555
+ <a href='#variants'>Variants</a></h2>\n " ) ?;
2543
2556
for variant in & e. variants {
2544
2557
let id = derive_id ( format ! ( "{}.{}" ,
2545
2558
ItemType :: Variant ,
@@ -2810,12 +2823,19 @@ fn render_assoc_items(w: &mut fmt::Formatter,
2810
2823
if !non_trait. is_empty ( ) {
2811
2824
let render_mode = match what {
2812
2825
AssocItemRender :: All => {
2813
- write ! ( w, "<h2 id='methods'>Methods</h2>" ) ?;
2826
+ write ! ( w, "
2827
+ <h2 id='methods' class='section-header'>
2828
+ <a href='#methods'>Methods</a>
2829
+ </h2>
2830
+ " ) ?;
2814
2831
RenderMode :: Normal
2815
2832
}
2816
2833
AssocItemRender :: DerefFor { trait_, type_, deref_mut_ } => {
2817
- write ! ( w, "<h2 id='deref-methods'>Methods from \
2818
- {}<Target = {}></h2>", trait_, type_) ?;
2834
+ write ! ( w, "
2835
+ <h2 id='deref-methods' class='section-header'>
2836
+ <a href='#deref-methods'>Methods from {}<Target = {}></a>
2837
+ </h2>
2838
+ " , trait_, type_) ?;
2819
2839
RenderMode :: ForDeref { mut_ : deref_mut_ }
2820
2840
}
2821
2841
} ;
@@ -2837,8 +2857,11 @@ fn render_assoc_items(w: &mut fmt::Formatter,
2837
2857
} ) . is_some ( ) ;
2838
2858
render_deref_methods ( w, cx, impl_, containing_item, has_deref_mut) ?;
2839
2859
}
2840
- write ! ( w, "<h2 id='implementations'>Trait \
2841
- Implementations</h2>") ?;
2860
+ write ! ( w, "
2861
+ <h2 id='implementations' class='section-header'>
2862
+ <a href='#implementations'>Trait Implementations</a>
2863
+ </h2>
2864
+ " ) ?;
2842
2865
for i in & traits {
2843
2866
let did = i. trait_did ( ) . unwrap ( ) ;
2844
2867
let assoc_link = AssocItemLink :: GotoSource ( did, & i. inner_impl ( ) . provided_trait_methods ) ;
0 commit comments