We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
std::io::empty
1 parent a0f572e commit a350ca6Copy full SHA for a350ca6
src/libstd/io/util.rs
@@ -78,14 +78,11 @@ pub struct Empty { _priv: () }
78
/// A slightly sad example of not reading anything into a buffer:
79
///
80
/// ```
81
-/// use std::io;
82
-/// use std::io::Read;
+/// use std::io::{self, Read};
83
84
-/// # fn foo() -> io::Result<String> {
85
/// let mut buffer = String::new();
86
-/// try!(io::empty().read_to_string(&mut buffer));
87
-/// # Ok(buffer)
88
-/// # }
+/// io::empty().read_to_string(&mut buffer).unwrap();
+/// assert!(buffer.is_empty());
89
90
#[stable(feature = "rust1", since = "1.0.0")]
91
pub fn empty() -> Empty { Empty { _priv: () } }
0 commit comments