File tree Expand file tree Collapse file tree 5 files changed +14
-6
lines changed Expand file tree Collapse file tree 5 files changed +14
-6
lines changed Original file line number Diff line number Diff line change @@ -18,7 +18,7 @@ impl Default for Limits {
18
18
Self {
19
19
memory : 3 * 1024 * 1024 * 1024 , // 3 GB
20
20
timeout : Duration :: from_secs ( 15 * 60 ) , // 15 minutes
21
- targets : 10 ,
21
+ targets : crate :: DEFAULT_MAX_TARGETS ,
22
22
networking : false ,
23
23
max_log_size : 100 * 1024 , // 100 KB
24
24
}
Original file line number Diff line number Diff line change @@ -62,3 +62,6 @@ pub const BUILD_VERSION: &str = concat!(
62
62
/// Example:
63
63
/// `s3://rust-docs-rs//rustdoc-static/something.css`
64
64
pub const RUSTDOC_STATIC_STORAGE_PREFIX : & str = "/rustdoc-static/" ;
65
+
66
+ /// Maximum number of targets allowed for a crate to be documented on.
67
+ pub const DEFAULT_MAX_TARGETS : usize = 10 ;
Original file line number Diff line number Diff line change @@ -93,8 +93,12 @@ macro_rules! impl_axum_webpage {
93
93
94
94
95
95
response. extensions_mut( ) . insert( $crate:: web:: page:: web_page:: DelayedTemplateRender {
96
- context: :: tera:: Context :: from_serialize( & self )
97
- . expect( "could not create tera context from web-page" ) ,
96
+ context: {
97
+ let mut c = :: tera:: Context :: from_serialize( & self )
98
+ . expect( "could not create tera context from web-page" ) ;
99
+ c. insert( "DEFAULT_MAX_TARGETS" , & $crate:: DEFAULT_MAX_TARGETS ) ;
100
+ c
101
+ } ,
98
102
template: {
99
103
let template: fn ( & Self ) -> :: std:: borrow:: Cow <' static , str > = $template;
100
104
template( & self ) . to_string( )
Original file line number Diff line number Diff line change @@ -317,7 +317,8 @@ impl RustdocPage {
317
317
let is_latest_url = self . is_latest_url ;
318
318
319
319
// Build the page of documentation
320
- let ctx = tera:: Context :: from_serialize ( self ) . context ( "error creating tera context" ) ?;
320
+ let mut ctx = tera:: Context :: from_serialize ( self ) . context ( "error creating tera context" ) ?;
321
+ ctx. insert ( "DEFAULT_MAX_TARGETS" , & crate :: DEFAULT_MAX_TARGETS ) ;
321
322
322
323
// Extract the head and body of the rustdoc file so that we can insert it into our own html
323
324
// while logging OOM errors from html rewriting
Original file line number Diff line number Diff line change 209
209
210
210
{# Build the dropdown list showing available targets #}
211
211
< ul class ="pure-menu-children " id ="platforms ">
212
- {%- if metadata.doc_targets|length < 6 -%}
213
- {%- include "rustdoc/targets.tml " -%}
212
+ {%- if metadata.doc_targets|length < DEFAULT _MAX_TARGETS -%}
213
+ {%- include "rustdoc/platforms.html " -%}
214
214
{%- else -%}
215
215
< span class="rotate "> {{ "spinner" | fas }}</ span >
216
216
{%- endif -%}
You can’t perform that action at this time.
0 commit comments