@@ -4,25 +4,25 @@ macro_rules! runtime_methods {
4
4
use std:: future:: Future ;
5
5
6
6
pub fn spawn<F >( future: F ) -> JoinHandle <F :: Output >
7
- where
8
- F : Future + Send + ' static ,
9
- F :: Output : Send + ' static ,
7
+ where
8
+ F : Future + Send + ' static ,
9
+ F :: Output : Send + ' static ,
10
10
{
11
11
RUNTIME . spawn( future)
12
12
}
13
13
14
14
pub fn spawn_blocking<F , T >( task: F ) -> JoinHandle <T >
15
- where
16
- F : FnOnce ( ) -> T + Send + ' static ,
17
- T : Send + ' static ,
15
+ where
16
+ F : FnOnce ( ) -> T + Send + ' static ,
17
+ T : Send + ' static ,
18
18
{
19
19
RUNTIME . spawn_blocking( task)
20
20
}
21
21
22
22
pub fn block_on<F >( future: F ) -> F :: Output
23
- where
24
- F : Future + Send + ' static ,
25
- F :: Output : Send + ' static ,
23
+ where
24
+ F : Future + Send + ' static ,
25
+ F :: Output : Send + ' static ,
26
26
{
27
27
RUNTIME . block_on( future)
28
28
}
@@ -31,54 +31,50 @@ macro_rules! runtime_methods {
31
31
32
32
#[ cfg( feature = "bastion" ) ]
33
33
pub mod runtime {
34
+ use agnostik:: executors:: BastionExecutor ;
35
+ use agnostik:: { Agnostik , AgnostikExecutor } ;
34
36
use once_cell:: sync:: Lazy ;
35
- use agnostik:: { AgnostikExecutor , Agnostik } ;
36
- use agnostik:: executors:: { BastionExecutor } ;
37
37
38
- static RUNTIME : Lazy < BastionExecutor > = Lazy :: new ( || unsafe {
39
- std:: mem:: transmute ( Agnostik :: bastion ( ) )
40
- } ) ;
38
+ static RUNTIME : Lazy < BastionExecutor > =
39
+ Lazy :: new ( || unsafe { std:: mem:: transmute ( Agnostik :: bastion ( ) ) } ) ;
41
40
42
41
runtime_methods ! ( ) ;
43
42
}
44
43
45
44
#[ cfg( feature = "tokio" ) ]
46
45
pub mod runtime {
47
- use once_cell:: sync:: Lazy ;
48
- use agnostik:: { Agnostik , LocalAgnostikExecutor } ;
49
46
use agnostik:: executors:: TokioExecutor ;
47
+ use agnostik:: { Agnostik , LocalAgnostikExecutor } ;
48
+ use once_cell:: sync:: Lazy ;
50
49
51
- static RUNTIME : Lazy < TokioExecutor > = Lazy :: new ( || unsafe {
52
- std:: mem:: transmute ( Agnostik :: tokio ( ) )
53
- } ) ;
50
+ static RUNTIME : Lazy < TokioExecutor > =
51
+ Lazy :: new ( || unsafe { std:: mem:: transmute ( Agnostik :: tokio ( ) ) } ) ;
54
52
55
53
runtime_methods ! ( ) ;
56
54
}
57
55
58
56
#[ cfg( feature = "asyncstd" ) ]
59
57
pub mod runtime {
60
- use once_cell:: sync:: Lazy ;
61
- use agnostik:: { Agnostik , LocalAgnostikExecutor } ;
62
58
use agnostik:: executors:: AsyncStdExecutor ;
59
+ use agnostik:: { Agnostik , LocalAgnostikExecutor } ;
60
+ use once_cell:: sync:: Lazy ;
63
61
64
- static RUNTIME : Lazy < AsyncStdExecutor > = Lazy :: new ( || unsafe {
65
- std:: mem:: transmute ( Agnostik :: async_std ( ) )
66
- } ) ;
62
+ static RUNTIME : Lazy < AsyncStdExecutor > =
63
+ Lazy :: new ( || unsafe { std:: mem:: transmute ( Agnostik :: async_std ( ) ) } ) ;
67
64
68
65
runtime_methods ! ( ) ;
69
66
}
70
67
71
68
#[ cfg( feature = "smol" ) ]
72
69
pub mod runtime {
73
- use once_cell:: sync:: Lazy ;
74
- use agnostik:: { Agnostik , LocalAgnostikExecutor } ;
75
70
use agnostik:: executors:: SmolExecutor ;
71
+ use agnostik:: { Agnostik , LocalAgnostikExecutor } ;
72
+ use once_cell:: sync:: Lazy ;
76
73
77
- static RUNTIME : Lazy < SmolExecutor > = Lazy :: new ( || unsafe {
78
- std:: mem:: transmute ( Agnostik :: smol ( ) )
79
- } ) ;
74
+ static RUNTIME : Lazy < SmolExecutor > =
75
+ Lazy :: new ( || unsafe { std:: mem:: transmute ( Agnostik :: smol ( ) ) } ) ;
80
76
81
77
runtime_methods ! ( ) ;
82
78
}
83
79
84
- pub use runtime:: * ;
80
+ pub use runtime:: * ;
0 commit comments