Function cros_async::select6

source ·
pub async fn select6<F1: Future + Unpin, F2: Future + Unpin, F3: Future + Unpin, F4: Future + Unpin, F5: Future + Unpin, F6: Future + Unpin>(
    f1: F1,
    f2: F2,
    f3: F3,
    f4: F4,
    f5: F5,
    f6: F6
) -> (SelectResult<F1>, SelectResult<F2>, SelectResult<F3>, SelectResult<F4>, SelectResult<F5>, SelectResult<F6>)
Expand description

Creates a combinator that runs the six given futures until one or more completes, returning a tuple containing the result of the finished future(s) and the still pending future(s).

§Example

use cros_async::{SelectResult, select6, block_on};
use futures::future::pending;
use futures::pin_mut;

let first = async {1};
let second = async {let () = pending().await;};
let third = async {3};
let fourth = async {let () = pending().await;};
let fifth = async {5};
let sixth = async {6};
pin_mut!(first);
pin_mut!(second);
pin_mut!(third);
pin_mut!(fourth);
pin_mut!(fifth);
pin_mut!(sixth);
match block_on(select6(first, second, third, fourth, fifth, sixth)) {
    (SelectResult::Finished(1), SelectResult::Pending(_second),
     SelectResult::Finished(3), SelectResult::Pending(_fourth),
     SelectResult::Finished(5), SelectResult::Finished(6)) => (),
    _ => panic!("Select didn't return the futures"),
};