std::io::empty

Function std::io::empty

pub fn empty() -> Empty

Constructs a new handle to an empty reader.

All reads from the returned reader will return Ok(0).

Examples

A slightly sad example of not reading anything into a buffer:

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

let mut buffer = String::new();
io::empty().read_to_string(&mut buffer).unwrap();
assert!(buffer.is_empty());

© 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.empty.html

在线笔记
App下载
App下载

扫描二维码

下载编程狮App

公众号
微信公众号

编程狮公众号

意见反馈
返回顶部