std::io::sink - Rust
Description: API documentation for the Rust `sink` fn in crate `std`.
Keywords: rust, rustlang, rust-lang, sink

# 1.0.0[−][src]Function std::io::sink

###

    pub fn sink() -> SinkⓘNotable traits for Sinkimpl Write for Sinkimpl<'_> Write for &'_ Sink

Creates an instance of a writer which will successfully consume all data.

All calls to `write` on the returned instance will return `Ok(buf.len())` and the contents of the buffer will not be inspected.

# Examples

    use std::io::{self, Write};

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

Run