[−][src]Crate quicksink
Create a Sink
implementation from an initial value and a closure
returning a Future
.
This is very similar to how futures::stream::unfold
creates a Stream
implementation from a seed value and a future-returning closure.
Examples
use async_std::io; use futures::prelude::*; use quicksink::Action; quicksink::make_sink(io::stdout(), |mut stdout, action| async move { match action { Action::Send(x) => stdout.write_all(x).await?, Action::Flush => stdout.flush().await?, Action::Close => stdout.close().await? } Ok::<_, io::Error>(stdout) });
Structs
SinkImpl |
|
Enums
Action | The command given to the closure so that it can perform appropriate action. |
Functions
make_sink | Returns a |