pub fn sink() -> Sink
Expand description
Creates an instance of a writer which will successfully consume all data.
All calls to poll_write
on the returned instance will return Poll::Ready(Ok(buf.len()))
and the contents of the buffer will not be inspected.
ยงExamples
use futures::io::{self, AsyncWriteExt};
let buffer = vec![1, 2, 3, 5, 8];
let mut writer = io::sink();
let num_bytes = writer.write(&buffer).await?;
assert_eq!(num_bytes, 5);