File tree Expand file tree Collapse file tree 2 files changed +15
-2
lines changed
Expand file tree Collapse file tree 2 files changed +15
-2
lines changed Original file line number Diff line number Diff line change 1+ use std:: { env, fs, path:: PathBuf } ;
2+
13fn main ( ) {
24 autocfg:: emit_possibility ( "borrowedbuf_init" ) ;
35 autocfg:: rerun_path ( "build.rs" ) ;
@@ -13,4 +15,16 @@ fn main() {
1315 if ac. probe_raw ( code) . is_ok ( ) {
1416 autocfg:: emit ( "borrowedbuf_init" ) ;
1517 }
18+
19+ let buf_size = env:: var ( "AXIO_DEFAULT_BUF_SIZE" )
20+ . map ( |v| v. parse :: < usize > ( ) . expect ( "Invalid AXIO_DEFAULT_BUF_SIZE" ) )
21+ . unwrap_or ( 1024 * 2 ) ;
22+ fs:: write (
23+ PathBuf :: from ( env:: var_os ( "OUT_DIR" ) . unwrap ( ) ) . join ( "config.rs" ) ,
24+ format ! (
25+ "/// Default buffer size for I/O operations.\n pub const DEFAULT_BUF_SIZE: usize = {};" ,
26+ buf_size
27+ ) ,
28+ )
29+ . expect ( "Failed to write config file" ) ;
1630}
Original file line number Diff line number Diff line change @@ -11,8 +11,7 @@ extern crate alloc;
1111#[ doc( no_inline) ]
1212pub use axerrno:: { AxError as Error , AxErrorKind as ErrorKind , AxResult as Result } ;
1313
14- /// Default buffer size for I/O operations.
15- pub const DEFAULT_BUF_SIZE : usize = 1024 * 2 ;
14+ include ! ( concat!( env!( "OUT_DIR" ) , "/config.rs" ) ) ;
1615
1716mod buffered;
1817pub mod prelude;
You can’t perform that action at this time.
0 commit comments