Skip to main content

select_buffer

Function select_buffer 

Source
pub async fn select_buffer(
    buffers: &[Controller],
    timeout: Option<Duration>,
    runtime: &Runtime,
) -> ControllerResult<Option<Controller>>
Expand description

Poll all given buffer controllers and wait, returning the first one ready.

It will spawn tasks blocked on AsyncReceiver::poll for each buffer controller. As soon as one finishes, its controller is returned and all other tasks are canceled.

If a timeout is provided, the result may be None if it expires before any task is complete.

It may return an error if all buffers returned errors while polling.