pub fn unfold<T, F, Fut, Item, E>(init: T, function: F) -> Unfold<T, F, Fut>
where
    F: FnMut(T, Item) -> Fut,
    Fut: Future<Output = Result<T, E>>,
{
    assert_sink::<Item, E, _>(Unfold { function, state: UnfoldState::Value { value: init } })
}
Create a sink from a function which processes one item at a time.

# Examples

```
# futures::executor::block_on(async {
use core::pin::pin;

use futures::sink;
use futures::sink::SinkExt;

let unfold = sink::unfold(0, |mut sum, i: i32| {
async move {
sum += i;
eprintln!("{}", i);
Ok::<_, std::convert::Infallible>(sum)
}
});
let mut unfold = pin!(unfold);
unfold.send(5).await?;
# Ok::<(), std::convert::Infallible>(()) }).unwrap();
```
futures-util/src/sink/unfold.rs