File tree Expand file tree Collapse file tree 5 files changed +15
-20
lines changed Expand file tree Collapse file tree 5 files changed +15
-20
lines changed Original file line number Diff line number Diff line change 1
1
//! Executors.
2
2
3
- use task:: TaskObj ;
4
-
5
3
pub use core:: task:: { Executor , SpawnErrorKind , SpawnObjError } ;
4
+
Original file line number Diff line number Diff line change 1
1
//! Core traits and types for asynchronous operations in Rust.
2
2
3
3
#![ feature( pin, arbitrary_self_types) ]
4
+ #![ feature( futures_api) ]
4
5
5
6
#![ no_std]
6
7
#![ deny( missing_docs, missing_debug_implementations, warnings) ]
Original file line number Diff line number Diff line change 1
- use core:: fmt;
2
1
3
- use executor:: Executor ;
4
- use task:: { TaskObj , Waker } ;
5
-
6
- use core:: task:: Context ;
2
+ pub use core:: task:: Context ;
7
3
8
4
if_std ! {
9
5
use Future ;
6
+ use task:: TaskObj ;
10
7
11
8
pub trait ContextExt {
12
9
/// Spawn a future onto the default executor.
Original file line number Diff line number Diff line change 1
1
//! Task notification.
2
2
3
3
use core:: mem:: { self , PinMut } ;
4
- use core:: fmt;
5
4
6
5
use { Future , Poll } ;
7
6
8
- mod wake;
9
- pub use self :: wake:: { UnsafeWake , Waker } ;
7
+ pub use core:: task:: { UnsafeWake , Waker } ;
10
8
#[ cfg( feature = "std" ) ]
11
- pub use self :: wake :: Wake ;
9
+ pub use std :: task :: Wake ;
12
10
13
11
mod context;
14
12
pub use self :: context:: Context ;
@@ -20,10 +18,11 @@ pub use self::atomic_waker::AtomicWaker;
20
18
21
19
pub use core:: task:: { TaskObj , UnsafePoll } ;
22
20
23
- // should be in std
21
+
24
22
if_std ! {
25
23
use std:: boxed:: Box ;
26
24
25
+ // should be in std
27
26
unsafe impl <F : Future <Output = ( ) > + Send + ' static > UnsafePoll for Box <F > {
28
27
fn into_raw( self ) -> * mut ( ) {
29
28
unsafe {
@@ -44,9 +43,14 @@ if_std! {
44
43
}
45
44
}
46
45
47
- impl TaskObj {
46
+ pub trait TaskObjExt {
47
+ /// Create a new `TaskObj` by boxing the given future.
48
+ fn new<F : Future <Output = ( ) > + Send + ' static >( f: F ) -> TaskObj ;
49
+ }
50
+
51
+ impl TaskObjExt for TaskObj {
48
52
/// Create a new `TaskObj` by boxing the given future.
49
- pub fn new<F : Future <Output = ( ) > + Send + ' static >( f: F ) -> TaskObj {
53
+ fn new<F : Future <Output = ( ) > + Send + ' static >( f: F ) -> TaskObj {
50
54
TaskObj :: from_poll_task( Box :: new( f) )
51
55
}
52
56
}
Load Diff This file was deleted.
You can’t perform that action at this time.
0 commit comments