File tree 3 files changed +17
-25
lines changed
3 files changed +17
-25
lines changed Original file line number Diff line number Diff line change @@ -20,6 +20,7 @@ use proc_macro::TokenStream;
20
20
use quote:: quote;
21
21
use std:: num:: NonZeroUsize ;
22
22
23
+ #[ derive( Clone , Copy , PartialEq ) ]
23
24
enum Runtime {
24
25
Basic ,
25
26
Threaded ,
@@ -145,21 +146,10 @@ fn parse_knobs(
145
146
}
146
147
}
147
148
148
- let mut rt = quote ! { tokio:: runtime:: Builder :: new( ) } ;
149
- match ( runtime, is_test) {
150
- ( Some ( Runtime :: Threaded ) , _) => {
151
- if rt_threaded {
152
- rt = quote ! { #rt. threaded_scheduler( ) }
153
- }
154
- }
155
- ( Some ( Runtime :: Basic ) , _) => rt = quote ! { #rt. basic_scheduler( ) } ,
156
- ( None , true ) => rt = quote ! { #rt. basic_scheduler( ) } ,
157
- ( None , false ) => {
158
- if rt_threaded {
159
- rt = quote ! { #rt. threaded_scheduler( ) }
160
- }
161
- }
162
- } ;
149
+ let mut rt = quote ! { tokio:: runtime:: Builder :: new( ) . basic_scheduler( ) } ;
150
+ if rt_threaded && ( runtime == Some ( Runtime :: Threaded ) || ( runtime. is_none ( ) && !is_test) ) {
151
+ rt = quote ! { #rt. threaded_scheduler( ) } ;
152
+ }
163
153
if let Some ( v) = core_threads. map ( |v| v. get ( ) ) {
164
154
rt = quote ! { #rt. core_threads( #v) } ;
165
155
}
Original file line number Diff line number Diff line change @@ -54,7 +54,7 @@ io-driver = ["mio", "lazy_static"]
54
54
io-util = [" memchr" ]
55
55
# stdin, stdout, stderr
56
56
io-std = [" rt-core" ]
57
- macros = [" rt-core " , " tokio-macros" ]
57
+ macros = [" tokio-macros" ]
58
58
net = [" dns" , " tcp" , " udp" , " uds" ]
59
59
process = [
60
60
" io-driver" ,
Original file line number Diff line number Diff line change @@ -264,16 +264,18 @@ cfg_time! {
264
264
mod util;
265
265
266
266
cfg_macros ! {
267
- cfg_rt_threaded! {
268
- #[ cfg( not( test) ) ] // Work around for rust-lang/rust#62127
269
- pub use tokio_macros:: main_threaded as main;
270
- pub use tokio_macros:: test_threaded as test;
271
- }
267
+ doc_rt_core! {
268
+ cfg_rt_threaded! {
269
+ #[ cfg( not( test) ) ] // Work around for rust-lang/rust#62127
270
+ pub use tokio_macros:: main_threaded as main;
271
+ pub use tokio_macros:: test_threaded as test;
272
+ }
272
273
273
- cfg_not_rt_threaded! {
274
- #[ cfg( not( test) ) ] // Work around for rust-lang/rust#62127
275
- pub use tokio_macros:: main_basic as main;
276
- pub use tokio_macros:: test_basic as test;
274
+ cfg_not_rt_threaded! {
275
+ #[ cfg( not( test) ) ] // Work around for rust-lang/rust#62127
276
+ pub use tokio_macros:: main_basic as main;
277
+ pub use tokio_macros:: test_basic as test;
278
+ }
277
279
}
278
280
}
279
281
You can’t perform that action at this time.
0 commit comments