Skip to content

Commit

Permalink
Stabilize fs::read and fs::write
Browse files Browse the repository at this point in the history
  • Loading branch information
mbrubeck committed Mar 28, 2018
1 parent 3efe61c commit 0600d0f
Showing 1 changed file with 2 additions and 6 deletions.
8 changes: 2 additions & 6 deletions src/libstd/fs.rs
Original file line number Diff line number Diff line change
Expand Up @@ -251,8 +251,6 @@ fn initial_buffer_size(file: &File) -> usize {
/// # Examples
///
/// ```no_run
/// #![feature(fs_read_write)]
///
/// use std::fs;
/// use std::net::SocketAddr;
///
Expand All @@ -261,7 +259,7 @@ fn initial_buffer_size(file: &File) -> usize {
/// # Ok(())
/// # }
/// ```
#[unstable(feature = "fs_read_write", issue = "46588")]
#[stable(feature = "fs_read_write_bytes", since = "1.27.0")]
pub fn read<P: AsRef<Path>>(path: P) -> io::Result<Vec<u8>> {
let mut file = File::open(path)?;
let mut bytes = Vec::with_capacity(initial_buffer_size(&file));
Expand Down Expand Up @@ -325,16 +323,14 @@ pub fn read_string<P: AsRef<Path>>(path: P) -> io::Result<String> {
/// # Examples
///
/// ```no_run
/// #![feature(fs_read_write)]
///
/// use std::fs;
///
/// # fn foo() -> std::io::Result<()> {
/// fs::write("foo.txt", b"Lorem ipsum")?;
/// # Ok(())
/// # }
/// ```
#[unstable(feature = "fs_read_write", issue = "46588")]
#[stable(feature = "fs_read_write_bytes", since = "1.27.0")]
pub fn write<P: AsRef<Path>, C: AsRef<[u8]>>(path: P, contents: C) -> io::Result<()> {
File::create(path)?.write_all(contents.as_ref())
}
Expand Down

0 comments on commit 0600d0f

Please sign in to comment.