fn try_take_while<Fut, F>(self, f: F) -> TryTakeWhile<Self, Fut, F>
    where
        F: FnMut(&Self::Ok) -> Fut,
        Fut: TryFuture<Ok = bool, Error = Self::Error>,
        Self: Sized,
    {
        assert_stream::<Result<Self::Ok, Self::Error>, _>(TryTakeWhile::new(self, f))
    }
Take elements on this stream while the provided asynchronous predicate
resolves to `true`.

This function is similar to
[`StreamExt::take_while`](crate::stream::StreamExt::take_while) but exits
early if an error occurs.

# Examples

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

let stream = stream::iter(vec![Ok::<i32, i32>(1), Ok(2), Ok(3), Ok(2)]);
let stream = stream.try_take_while(|x| future::ready(Ok(*x < 3)));

let output: Result<Vec<i32>, i32> = stream.try_collect().await;
assert_eq!(output, Ok(vec![1, 2]));
# })
```
futures-util/src/stream/try_stream/mod.rs