@@ -111,13 +111,13 @@ fn run_spawn_many() {
111
111
}
112
112
113
113
#[ test]
114
- fn poll_one_returns_if_empty ( ) {
114
+ fn try_run_one_returns_if_empty ( ) {
115
115
let mut pool = LocalPool :: new ( ) ;
116
- assert ! ( pool. poll_one ( ) == false ) ;
116
+ assert ! ( pool. try_run_one ( ) == false ) ;
117
117
}
118
118
119
119
#[ test]
120
- fn poll_one_executes_one_ready ( ) {
120
+ fn try_run_one_executes_one_ready ( ) {
121
121
const ITER : usize = 200 ;
122
122
123
123
let cnt = Rc :: new ( Cell :: new ( 0 ) ) ;
@@ -139,14 +139,14 @@ fn poll_one_executes_one_ready() {
139
139
140
140
for i in 0 ..ITER {
141
141
assert_eq ! ( cnt. get( ) , i) ;
142
- assert ! ( pool. poll_one ( ) ) ;
142
+ assert ! ( pool. try_run_one ( ) ) ;
143
143
assert_eq ! ( cnt. get( ) , i + 1 ) ;
144
144
}
145
- assert ! ( pool. poll_one ( ) == false ) ;
145
+ assert ! ( pool. try_run_one ( ) == false ) ;
146
146
}
147
147
148
148
#[ test]
149
- fn poll_one_returns_on_no_progress ( ) {
149
+ fn try_run_one_returns_on_no_progress ( ) {
150
150
const ITER : usize = 10 ;
151
151
152
152
let cnt = Rc :: new ( Cell :: new ( 0 ) ) ;
@@ -171,42 +171,42 @@ fn poll_one_returns_on_no_progress() {
171
171
172
172
for i in 0 ..ITER - 1 {
173
173
assert_eq ! ( cnt. get( ) , i) ;
174
- assert ! ( !pool. poll_one ( ) ) ;
174
+ assert ! ( !pool. try_run_one ( ) ) ;
175
175
assert_eq ! ( cnt. get( ) , i + 1 ) ;
176
176
let w = waker. take ( ) ;
177
177
assert ! ( w. is_some( ) ) ;
178
178
w. unwrap ( ) . wake ( ) ;
179
179
}
180
- assert ! ( pool. poll_one ( ) ) ;
180
+ assert ! ( pool. try_run_one ( ) ) ;
181
181
assert_eq ! ( cnt. get( ) , ITER ) ;
182
182
}
183
183
184
184
#[ test]
185
- fn poll_returns_if_empty ( ) {
185
+ fn run_until_stalled_returns_if_empty ( ) {
186
186
let mut pool = LocalPool :: new ( ) ;
187
- pool. poll ( ) ;
188
- pool. poll ( ) ;
187
+ pool. run_until_stalled ( ) ;
188
+ pool. run_until_stalled ( ) ;
189
189
}
190
190
191
191
#[ test]
192
- fn poll_returns_multiple_times ( ) {
192
+ fn run_until_stalled_returns_multiple_times ( ) {
193
193
let mut pool = LocalPool :: new ( ) ;
194
194
let mut spawn = pool. spawner ( ) ;
195
195
let cnt = Rc :: new ( Cell :: new ( 0 ) ) ;
196
196
197
197
let cnt1 = cnt. clone ( ) ;
198
198
spawn. spawn_local_obj ( Box :: pin ( lazy ( move |_|{ cnt1. set ( cnt1. get ( ) + 1 ) } ) ) . into ( ) ) . unwrap ( ) ;
199
- pool. poll ( ) ;
199
+ pool. run_until_stalled ( ) ;
200
200
assert_eq ! ( cnt. get( ) , 1 ) ;
201
201
202
202
let cnt2 = cnt. clone ( ) ;
203
203
spawn. spawn_local_obj ( Box :: pin ( lazy ( move |_|{ cnt2. set ( cnt2. get ( ) + 1 ) } ) ) . into ( ) ) . unwrap ( ) ;
204
- pool. poll ( ) ;
204
+ pool. run_until_stalled ( ) ;
205
205
assert_eq ! ( cnt. get( ) , 2 ) ;
206
206
}
207
207
208
208
#[ test]
209
- fn poll_executes_all_ready ( ) {
209
+ fn run_until_stalled_executes_all_ready ( ) {
210
210
const ITER : usize = 200 ;
211
211
const PER_ITER : usize = 3 ;
212
212
@@ -229,7 +229,7 @@ fn poll_executes_all_ready() {
229
229
spawn. spawn_local_obj ( Box :: pin ( pending ( ) ) . into ( ) ) . unwrap ( ) ;
230
230
}
231
231
assert_eq ! ( cnt. get( ) , i * PER_ITER ) ;
232
- pool. poll ( ) ;
232
+ pool. run_until_stalled ( ) ;
233
233
assert_eq ! ( cnt. get( ) , ( i + 1 ) * PER_ITER ) ;
234
234
}
235
235
}
@@ -250,13 +250,13 @@ fn nesting_run() {
250
250
251
251
#[ test]
252
252
#[ should_panic]
253
- fn nesting_run_poll ( ) {
253
+ fn nesting_run_run_until_stalled ( ) {
254
254
let mut pool = LocalPool :: new ( ) ;
255
255
let mut spawn = pool. spawner ( ) ;
256
256
257
257
spawn. spawn_obj ( Box :: pin ( lazy ( |_| {
258
258
let mut pool = LocalPool :: new ( ) ;
259
- pool. poll ( ) ;
259
+ pool. run_until_stalled ( ) ;
260
260
} ) ) . into ( ) ) . unwrap ( ) ;
261
261
262
262
pool. run ( ) ;
0 commit comments