@@ -772,6 +772,9 @@ fn write_shared(
772
772
write_minify ( cx. dst . join ( & format ! ( "settings{}.css" , cx. shared. resource_suffix) ) ,
773
773
static_files:: SETTINGS_CSS ,
774
774
options. enable_minification ) ?;
775
+ write_minify ( cx. dst . join ( & format ! ( "noscript{}.css" , cx. shared. resource_suffix) ) ,
776
+ static_files:: NOSCRIPT_CSS ,
777
+ options. enable_minification ) ?;
775
778
776
779
// To avoid "light.css" to be overwritten, we'll first run over the received themes and only
777
780
// then we'll run over the "official" styles.
@@ -865,9 +868,8 @@ themePicker.onblur = handleThemeButtonsBlur;
865
868
}
866
869
867
870
{
868
- let mut data = format ! ( "var resourcesSuffix = \" {}\" ;\n " ,
869
- cx. shared. resource_suffix) ;
870
- data. push_str ( static_files:: STORAGE_JS ) ;
871
+ let mut data = static_files:: STORAGE_JS . to_owned ( ) ;
872
+ data. push_str ( & format ! ( "var resourcesSuffix = \" {}\" ;" , cx. shared. resource_suffix) ) ;
871
873
write_minify ( cx. dst . join ( & format ! ( "storage{}.js" , cx. shared. resource_suffix) ) ,
872
874
& data,
873
875
options. enable_minification ) ?;
@@ -3013,6 +3015,22 @@ fn item_trait(
3013
3015
// Trait documentation
3014
3016
document ( w, cx, it) ?;
3015
3017
3018
+ fn write_small_section_header (
3019
+ w : & mut fmt:: Formatter ,
3020
+ id : & str ,
3021
+ title : & str ,
3022
+ extra_content : & str ,
3023
+ ) -> fmt:: Result {
3024
+ write ! ( w, "
3025
+ <h2 id='{0}' class='small-section-header'>\
3026
+ {1}<a href='#{0}' class='anchor'></a>\
3027
+ </h2>{2}", id, title, extra_content)
3028
+ }
3029
+
3030
+ fn write_loading_content ( w : & mut fmt:: Formatter , extra_content : & str ) -> fmt:: Result {
3031
+ write ! ( w, "{}<span class='loading-content'>Loading content...</span>" , extra_content)
3032
+ }
3033
+
3016
3034
fn trait_item ( w : & mut fmt:: Formatter , cx : & Context , m : & clean:: Item , t : & clean:: Item )
3017
3035
-> fmt:: Result {
3018
3036
let name = m. name . as_ref ( ) . unwrap ( ) ;
@@ -3033,74 +3051,45 @@ fn item_trait(
3033
3051
}
3034
3052
3035
3053
if !types. is_empty ( ) {
3036
- write ! ( w, "
3037
- <h2 id='associated-types' class='small-section-header'>
3038
- Associated Types<a href='#associated-types' class='anchor'></a>
3039
- </h2>
3040
- <div class='methods'>
3041
- " ) ?;
3054
+ write_small_section_header ( w, "associated-types" , "Associated Types" ,
3055
+ "<div class='methods'>" ) ?;
3042
3056
for t in & types {
3043
3057
trait_item ( w, cx, * t, it) ?;
3044
3058
}
3045
- write ! ( w, "</div>" ) ?;
3059
+ write_loading_content ( w, "</div>" ) ?;
3046
3060
}
3047
3061
3048
3062
if !consts. is_empty ( ) {
3049
- write ! ( w, "
3050
- <h2 id='associated-const' class='small-section-header'>
3051
- Associated Constants<a href='#associated-const' class='anchor'></a>
3052
- </h2>
3053
- <div class='methods'>
3054
- " ) ?;
3063
+ write_small_section_header ( w, "associated-const" , "Associated Constants" ,
3064
+ "<div class='methods'>" ) ?;
3055
3065
for t in & consts {
3056
3066
trait_item ( w, cx, * t, it) ?;
3057
3067
}
3058
- write ! ( w, "</div>" ) ?;
3068
+ write_loading_content ( w, "</div>" ) ?;
3059
3069
}
3060
3070
3061
3071
// Output the documentation for each function individually
3062
3072
if !required. is_empty ( ) {
3063
- write ! ( w, "
3064
- <h2 id='required-methods' class='small-section-header'>
3065
- Required Methods<a href='#required-methods' class='anchor'></a>
3066
- </h2>
3067
- <div class='methods'>
3068
- " ) ?;
3073
+ write_small_section_header ( w, "required-methods" , "Required methods" ,
3074
+ "<div class='methods'>" ) ?;
3069
3075
for m in & required {
3070
3076
trait_item ( w, cx, * m, it) ?;
3071
3077
}
3072
- write ! ( w, "</div>" ) ?;
3078
+ write_loading_content ( w, "</div>" ) ?;
3073
3079
}
3074
3080
if !provided. is_empty ( ) {
3075
- write ! ( w, "
3076
- <h2 id='provided-methods' class='small-section-header'>
3077
- Provided Methods<a href='#provided-methods' class='anchor'></a>
3078
- </h2>
3079
- <div class='methods'>
3080
- " ) ?;
3081
+ write_small_section_header ( w, "provided-methods" , "Provided methods" ,
3082
+ "<div class='methods'>" ) ?;
3081
3083
for m in & provided {
3082
3084
trait_item ( w, cx, * m, it) ?;
3083
3085
}
3084
- write ! ( w, "</div>" ) ?;
3086
+ write_loading_content ( w, "</div>" ) ?;
3085
3087
}
3086
3088
3087
3089
// If there are methods directly on this trait object, render them here.
3088
3090
render_assoc_items ( w, cx, it, it. def_id , AssocItemRender :: All ) ?;
3089
3091
3090
3092
let cache = cache ( ) ;
3091
- let impl_header = "\
3092
- <h2 id='implementors' class='small-section-header'>\
3093
- Implementors<a href='#implementors' class='anchor'></a>\
3094
- </h2>\
3095
- <div class='item-list' id='implementors-list'>\
3096
- ";
3097
-
3098
- let synthetic_impl_header = "\
3099
- <h2 id='synthetic-implementors' class='small-section-header'>\
3100
- Auto implementors<a href='#synthetic-implementors' class='anchor'></a>\
3101
- </h2>\
3102
- <div class='item-list' id='synthetic-implementors-list'>\
3103
- ";
3104
3093
3105
3094
let mut synthetic_types = Vec :: new ( ) ;
3106
3095
@@ -3137,11 +3126,7 @@ fn item_trait(
3137
3126
concrete. sort_by ( compare_impl) ;
3138
3127
3139
3128
if !foreign. is_empty ( ) {
3140
- write ! ( w, "
3141
- <h2 id='foreign-impls' class='small-section-header'>
3142
- Implementations on Foreign Types<a href='#foreign-impls' class='anchor'></a>
3143
- </h2>
3144
- " ) ?;
3129
+ write_small_section_header ( w, "foreign-impls" , "Implementations on Foreign Types" , "" ) ?;
3145
3130
3146
3131
for implementor in foreign {
3147
3132
let assoc_link = AssocItemLink :: GotoSource (
@@ -3152,33 +3137,38 @@ fn item_trait(
3152
3137
RenderMode :: Normal , implementor. impl_item . stable_since ( ) , false ,
3153
3138
None ) ?;
3154
3139
}
3140
+ write_loading_content ( w, "" ) ?;
3155
3141
}
3156
3142
3157
- write ! ( w, "{}" , impl_header) ?;
3143
+ write_small_section_header ( w, "implementors" , "Implementors" ,
3144
+ "<div class='item-list' id='implementors-list'>" ) ?;
3158
3145
for implementor in concrete {
3159
3146
render_implementor ( cx, implementor, w, & implementor_dups) ?;
3160
3147
}
3161
- write ! ( w, "</div>" ) ?;
3148
+ write_loading_content ( w, "</div>" ) ?;
3162
3149
3163
3150
if t. auto {
3164
- write ! ( w, "{}" , synthetic_impl_header) ?;
3151
+ write_small_section_header ( w, "synthetic-implementors" , "Auto implementors" ,
3152
+ "<div class='item-list' id='synthetic-implementors-list'>" ) ?;
3165
3153
for implementor in synthetic {
3166
3154
synthetic_types. extend (
3167
3155
collect_paths_for_type ( implementor. inner_impl ( ) . for_ . clone ( ) )
3168
3156
) ;
3169
3157
render_implementor ( cx, implementor, w, & implementor_dups) ?;
3170
3158
}
3171
- write ! ( w, "</div>" ) ?;
3159
+ write_loading_content ( w, "</div>" ) ?;
3172
3160
}
3173
3161
} else {
3174
3162
// even without any implementations to write in, we still want the heading and list, so the
3175
3163
// implementors javascript file pulled in below has somewhere to write the impls into
3176
- write ! ( w, "{}" , impl_header) ?;
3177
- write ! ( w, "</div>" ) ?;
3164
+ write_small_section_header ( w, "implementors" , "Implementors" ,
3165
+ "<div class='item-list' id='implementors-list'>" ) ?;
3166
+ write_loading_content ( w, "</div>" ) ?;
3178
3167
3179
3168
if t. auto {
3180
- write ! ( w, "{}" , synthetic_impl_header) ?;
3181
- write ! ( w, "</div>" ) ?;
3169
+ write_small_section_header ( w, "synthetic-implementors" , "Auto implementors" ,
3170
+ "<div class='item-list' id='synthetic-implementors-list'>" ) ?;
3171
+ write_loading_content ( w, "</div>" ) ?;
3182
3172
}
3183
3173
}
3184
3174
write ! ( w, r#"<script type="text/javascript">window.inlined_types=new Set({});</script>"# ,
0 commit comments