1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
|
extern crate futures;
use futures::prelude::*;
use futures::future::{ok, select_all, err};
#[test]
fn smoke() {
let v = vec![
ok(1),
err(2),
ok(3),
];
let (i, idx, v) = select_all(v).wait().ok().unwrap();
assert_eq!(i, 1);
assert_eq!(idx, 0);
let (i, idx, v) = select_all(v).wait().err().unwrap();
assert_eq!(i, 2);
assert_eq!(idx, 0);
let (i, idx, v) = select_all(v).wait().ok().unwrap();
assert_eq!(i, 3);
assert_eq!(idx, 0);
assert!(v.is_empty());
}
|