[][src]Function tokio::io::sink

pub fn sink() -> Sink
This is supported on feature="io-util" only.

Creates an instance of an async 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.

This is an asynchronous version of std::io::sink.

Examples

let buffer = vec![1, 2, 3, 5, 8];
let num_bytes = io::sink().write(&buffer).await.unwrap();
assert_eq!(num_bytes, 5);