@@ -171,7 +171,7 @@ enum Timeout {
171
171
/// Successful receive operations will have to be followed up by `channel::read()` and successful
172
172
/// send operations by `channel::write()`.
173
173
fn run_select (
174
- handles : & mut [ ( & SelectHandle , usize , * const u8 ) ] ,
174
+ handles : & mut [ ( & dyn SelectHandle , usize , * const u8 ) ] ,
175
175
timeout : Timeout ,
176
176
) -> Option < ( Token , usize , * const u8 ) > {
177
177
if handles. is_empty ( ) {
@@ -220,7 +220,7 @@ fn run_select(
220
220
registered_count += 1 ;
221
221
222
222
// If registration returns `false`, that means the operation has just become ready.
223
- if handle. register ( Operation :: hook :: < & SelectHandle > ( handle) , cx) {
223
+ if handle. register ( Operation :: hook :: < & dyn SelectHandle > ( handle) , cx) {
224
224
// Try aborting select.
225
225
sel = match cx. try_select ( Selected :: Aborted ) {
226
226
Ok ( ( ) ) => {
@@ -259,7 +259,7 @@ fn run_select(
259
259
260
260
// Unregister all registered operations.
261
261
for ( handle, _, _) in handles. iter_mut ( ) . take ( registered_count) {
262
- handle. unregister ( Operation :: hook :: < & SelectHandle > ( handle) ) ;
262
+ handle. unregister ( Operation :: hook :: < & dyn SelectHandle > ( handle) ) ;
263
263
}
264
264
265
265
match sel {
@@ -279,7 +279,7 @@ fn run_select(
279
279
// Find the selected operation.
280
280
for ( handle, i, ptr) in handles. iter_mut ( ) {
281
281
// Is this the selected operation?
282
- if sel == Selected :: Operation ( Operation :: hook :: < & SelectHandle > ( handle) ) {
282
+ if sel == Selected :: Operation ( Operation :: hook :: < & dyn SelectHandle > ( handle) ) {
283
283
// Try selecting this operation.
284
284
if handle. accept ( & mut token, cx) {
285
285
return Some ( ( * i, * ptr) ) ;
@@ -317,7 +317,7 @@ fn run_select(
317
317
}
318
318
319
319
/// Runs until one of the operations becomes ready, potentially blocking the current thread.
320
- fn run_ready ( handles : & mut [ ( & SelectHandle , usize , * const u8 ) ] , timeout : Timeout ) -> Option < usize > {
320
+ fn run_ready ( handles : & mut [ ( & dyn SelectHandle , usize , * const u8 ) ] , timeout : Timeout ) -> Option < usize > {
321
321
if handles. is_empty ( ) {
322
322
// Wait until the timeout and return.
323
323
match timeout {
@@ -372,7 +372,7 @@ fn run_ready(handles: &mut [(&SelectHandle, usize, *const u8)], timeout: Timeout
372
372
// Begin watching all operations.
373
373
for ( handle, _, _) in handles. iter_mut ( ) {
374
374
registered_count += 1 ;
375
- let oper = Operation :: hook :: < & SelectHandle > ( handle) ;
375
+ let oper = Operation :: hook :: < & dyn SelectHandle > ( handle) ;
376
376
377
377
// If registration returns `false`, that means the operation has just become ready.
378
378
if handle. watch ( oper, cx) {
@@ -410,7 +410,7 @@ fn run_ready(handles: &mut [(&SelectHandle, usize, *const u8)], timeout: Timeout
410
410
411
411
// Unwatch all operations.
412
412
for ( handle, _, _) in handles. iter_mut ( ) . take ( registered_count) {
413
- handle. unwatch ( Operation :: hook :: < & SelectHandle > ( handle) ) ;
413
+ handle. unwatch ( Operation :: hook :: < & dyn SelectHandle > ( handle) ) ;
414
414
}
415
415
416
416
match sel {
@@ -419,7 +419,7 @@ fn run_ready(handles: &mut [(&SelectHandle, usize, *const u8)], timeout: Timeout
419
419
Selected :: Disconnected => { }
420
420
Selected :: Operation ( _) => {
421
421
for ( handle, i, _) in handles. iter_mut ( ) {
422
- let oper = Operation :: hook :: < & SelectHandle > ( handle) ;
422
+ let oper = Operation :: hook :: < & dyn SelectHandle > ( handle) ;
423
423
if sel == Selected :: Operation ( oper) {
424
424
return Some ( * i) ;
425
425
}
@@ -440,7 +440,7 @@ fn run_ready(handles: &mut [(&SelectHandle, usize, *const u8)], timeout: Timeout
440
440
/// Attempts to select one of the operations without blocking.
441
441
#[ inline]
442
442
pub fn try_select < ' a > (
443
- handles : & mut [ ( & ' a SelectHandle , usize , * const u8 ) ] ,
443
+ handles : & mut [ ( & ' a dyn SelectHandle , usize , * const u8 ) ] ,
444
444
) -> Result < SelectedOperation < ' a > , TrySelectError > {
445
445
match run_select ( handles, Timeout :: Now ) {
446
446
None => Err ( TrySelectError ) ,
@@ -455,7 +455,7 @@ pub fn try_select<'a>(
455
455
456
456
/// Blocks until one of the operations becomes ready and selects it.
457
457
#[ inline]
458
- pub fn select < ' a > ( handles : & mut [ ( & ' a SelectHandle , usize , * const u8 ) ] ) -> SelectedOperation < ' a > {
458
+ pub fn select < ' a > ( handles : & mut [ ( & ' a dyn SelectHandle , usize , * const u8 ) ] ) -> SelectedOperation < ' a > {
459
459
if handles. is_empty ( ) {
460
460
panic ! ( "no operations have been added to `Select`" ) ;
461
461
}
@@ -472,7 +472,7 @@ pub fn select<'a>(handles: &mut [(&'a SelectHandle, usize, *const u8)]) -> Selec
472
472
/// Blocks for a limited time until one of the operations becomes ready and selects it.
473
473
#[ inline]
474
474
pub fn select_timeout < ' a > (
475
- handles : & mut [ ( & ' a SelectHandle , usize , * const u8 ) ] ,
475
+ handles : & mut [ ( & ' a dyn SelectHandle , usize , * const u8 ) ] ,
476
476
timeout : Duration ,
477
477
) -> Result < SelectedOperation < ' a > , SelectTimeoutError > {
478
478
let timeout = Timeout :: At ( Instant :: now ( ) + timeout) ;
@@ -573,7 +573,7 @@ pub fn select_timeout<'a>(
573
573
/// [`ready_timeout`]: struct.Select.html#method.ready_timeout
574
574
pub struct Select < ' a > {
575
575
/// A list of senders and receivers participating in selection.
576
- handles : Vec < ( & ' a SelectHandle , usize , * const u8 ) > ,
576
+ handles : Vec < ( & ' a dyn SelectHandle , usize , * const u8 ) > ,
577
577
578
578
/// The next index to assign to an operation.
579
579
next_index : usize ,
0 commit comments