fn with_flat_map<U, St, F>(self, f: F) -> WithFlatMap<Self, Item, U, St, F>
    where
        F: FnMut(U) -> St,
        St: Stream<Item = Result<Item, Self::Error>>,
        Self: Sized,
    {
        assert_sink::<U, Self::Error, _>(WithFlatMap::new(self, f))
    }
Composes a function *in front of* the sink.

This adapter produces a new sink that passes each value through the
given function `f` before sending it to `self`.

To process each value, `f` produces a *stream*, of which each value
is passed to the underlying sink. A new value will not be accepted until
the stream has been drained

Note that this function consumes the given sink, returning a wrapped
version, much like `Iterator::flat_map`.

# Examples

```
# futures::executor::block_on(async {
use futures::channel::mpsc;
use futures::sink::SinkExt;
use futures::stream::{self, StreamExt};

let (tx, rx) = mpsc::channel(5);

let mut tx = tx.with_flat_map(|x| {
stream::iter(vec![Ok(42); x])
});

tx.send(5).await.unwrap();
drop(tx);
let received: Vec<i32> = rx.collect().await;
assert_eq!(received, vec![42, 42, 42, 42, 42]);
# });
```
futures-util/src/sink/mod.rs