1
+ use crate :: { enter, ThreadPool } ;
1
2
use futures_core:: future:: { Future , FutureObj , LocalFutureObj } ;
2
3
use futures_core:: stream:: { Stream } ;
3
4
use futures_core:: task:: {
@@ -6,6 +7,8 @@ use futures_core::task::{
6
7
} ;
7
8
use futures_util:: stream:: FuturesUnordered ;
8
9
use futures_util:: stream:: StreamExt ;
10
+ use lazy_static:: lazy_static;
11
+ use pin_utils:: pin_mut;
9
12
use std:: cell:: { RefCell } ;
10
13
use std:: marker:: Unpin ;
11
14
use std:: ops:: { Deref , DerefMut } ;
@@ -14,9 +17,6 @@ use std::rc::{Rc, Weak};
14
17
use std:: sync:: Arc ;
15
18
use std:: thread:: { self , Thread } ;
16
19
17
- use crate :: enter;
18
- use crate :: ThreadPool ;
19
-
20
20
/// A single-threaded task pool for polling futures to completion.
21
21
///
22
22
/// This executor allows you to multiplex any number of tasks onto a single
@@ -101,18 +101,15 @@ impl LocalPool {
101
101
/// the `LocalPool` by using its executor handle:
102
102
///
103
103
/// ```
104
- /// # extern crate futures;
105
- /// # use futures::executor::LocalPool;
104
+ /// use futures::executor::LocalPool;
106
105
///
107
- /// # fn main() {
108
106
/// let mut pool = LocalPool::new();
109
107
/// let mut exec = pool.executor();
110
108
///
111
109
/// // ... spawn some initial tasks using `exec.spawn()` or `exec.spawn_local()`
112
110
///
113
111
/// // run *all* tasks in the pool to completion, including any newly-spawned ones.
114
112
/// pool.run(&mut exec);
115
- /// # }
116
113
/// ```
117
114
///
118
115
/// The function will block the calling thread until *all* tasks in the pool
@@ -129,19 +126,16 @@ impl LocalPool {
129
126
///
130
127
/// ```
131
128
/// # #![feature(pin, arbitrary_self_types, futures_api)]
132
- /// # extern crate futures;
133
- /// # use futures::executor::LocalPool;
134
- /// # use futures::future::ready;
129
+ /// use futures::executor::LocalPool;
130
+ /// use futures::future::ready;
135
131
///
136
- /// # fn main() {
137
132
/// let mut pool = LocalPool::new();
138
133
/// let mut exec = pool.executor();
139
134
/// # let my_app = ready(());
140
135
///
141
136
/// // run tasks in the pool until `my_app` completes, by default spawning
142
137
/// // further tasks back onto the pool
143
138
/// pool.run_until(my_app, &mut exec);
144
- /// # }
145
139
/// ```
146
140
///
147
141
/// The function will block the calling thread *only* until the future `f`
0 commit comments