std::io::sink

Function std::io::sink

pub fn sink() -> 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);

© 2010 The Rust Project Developers
Licensed under the Apache License, Version 2.0 or the MIT license, at your option.
https://doc.rust-lang.org/std/io/fn.sink.html

在线笔记
App下载
App下载

扫描二维码

下载编程狮App

公众号
微信公众号

编程狮公众号

意见反馈
返回顶部