Skip to content

Commit b87b660

Browse files
authored
Rollup merge of rust-lang#100337 - camelid:stabilize-io_read_to_string, r=JohnTitor
Stabilize `std::io::read_to_string` Closes rust-lang#80218. 🎉 This PR stabilizes the `std::io::read_to_string` function, with the following public API: ```rust pub fn read_to_string<R: Read>(reader: R) -> Result<String>; ``` It's analogous to `std::fs::read_to_string` for files, but it works on anything that implements `io::Read`, including `io::stdin()`. See the tracking issue (rust-lang#80218) or documentation for details.
2 parents 049c73e + c04568b commit b87b660

File tree

1 file changed

+1
-3
lines changed

1 file changed

+1
-3
lines changed

library/std/src/io/mod.rs

Lines changed: 1 addition & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1032,8 +1032,6 @@ pub trait Read {
10321032
/// # Examples
10331033
///
10341034
/// ```no_run
1035-
/// #![feature(io_read_to_string)]
1036-
///
10371035
/// # use std::io;
10381036
/// fn main() -> io::Result<()> {
10391037
/// let stdin = io::read_to_string(io::stdin())?;
@@ -1042,7 +1040,7 @@ pub trait Read {
10421040
/// Ok(())
10431041
/// }
10441042
/// ```
1045-
#[unstable(feature = "io_read_to_string", issue = "80218")]
1043+
#[stable(feature = "io_read_to_string", since = "1.65.0")]
10461044
pub fn read_to_string<R: Read>(mut reader: R) -> Result<String> {
10471045
let mut buf = String::new();
10481046
reader.read_to_string(&mut buf)?;

0 commit comments

Comments
 (0)