Skip to main content

select

Function select 

Source
pub fn select<A: Future, B: Future>(a: A, b: B) -> Select<A, B> 
Expand description

Poll two futures concurrently, returning whichever completes first. Poll two futures concurrently, returning whichever completes first.

Biased: always polls a before b. When both are ready simultaneously, a wins. The losing future is dropped.

Safe with ringline I/O futures — data buffered for a dropped WithDataFuture remains in the accumulator and is consumed on the next with_data() call. Dropped SleepFutures correctly cancel their io_uring timeout SQE.