fn try_for_each<Fut, F>(self, f: F) -> TryForEach<Self, Fut, F>
    where
        F: FnMut(Self::Item) -> Fut,
        Fut: TryFuture<Ok = ()>,
        Self: Sized,
    {
        assert_future::<Result<(), Fut::Error>, _>(TryForEach::new(self, f))
    }
Attempts to run this stream to completion, executing the provided
asynchronous closure for each element on the stream.

The provided closure will be called for each item this stream produces,
yielding a future. That future will then be executed to completion
before moving on to the next item.

The returned value is a [`Future`](futures_core::future::Future) where
the [`Output`](futures_core::future::Future::Output) type is
`Result<(), Fut::Error>`. If any of the intermediate futures returns
an error, this future will return immediately with an error.

# Examples

```
# futures::executor::block_on(async {
use futures::future;
use futures::stream::{self, StreamExt};

let mut x = 0i32;

{
let fut = stream::repeat(1).try_for_each(|item| {
x += item;
future::ready(if x == 3 { Err(()) } else { Ok(()) })
});
assert_eq!(fut.await, Err(()));
}

assert_eq!(x, 3);
# })
```
futures-util/src/stream/stream/mod.rs