6 let workers = (0..0).map(|_| result::<u32, ()>());
7 drop(join_all(workers).poll());
14 fn poll(&mut self) -> Result<Self::Item, Self::Error>;
18 type Future: Future<Item=Self::Item, Error=Self::Error>;
22 fn into_future(self) -> Self::Future;
25 impl<F: Future> IntoFuture for F {
28 type Error = F::Error;
30 fn into_future(self) -> F {
35 struct FutureResult<T, E> {
36 _inner: marker::PhantomData<(T, E)>,
39 fn result<T, E>() -> FutureResult<T, E> {
43 impl<T, E> Future for FutureResult<T, E> {
47 fn poll(&mut self) -> Result<T, E> {
53 where I: IntoIterator,
56 elems: Vec<<I::Item as IntoFuture>::Item>,
59 fn join_all<I>(_: I) -> JoinAll<I>
60 where I: IntoIterator,
63 JoinAll { elems: vec![] }
66 impl<I> Future for JoinAll<I>
67 where I: IntoIterator,
70 type Item = Vec<<I::Item as IntoFuture>::Item>;
71 type Error = <I::Item as IntoFuture>::Error;
73 fn poll(&mut self) -> Result<Self::Item, Self::Error> {
74 let elems = mem::replace(&mut self.elems, Vec::new());
75 Ok(elems.into_iter().map(|e| {
77 }).collect::<Vec<_>>())