Open
Description
Feature gate: #![feature(file_buffered)]
This is a tracking issue for File
constructors that return files wrapped with a buffer.
In addition to the light convenience, these are intended to raise visibility that buffering is something you should consider when opening a file, since unbuffered I/O is a common performance footgun to Rust newcomers.
Public API
// std::fs
impl File {
pub fn open_buffered<P: AsRef<Path>>(path: P) -> io::Result<io::BufReader<File>>;
pub fn create_buffered<P: AsRef<Path>>(path: P) -> io::Result<io::BufWriter<File>>;
}
Steps / History
- API Change Proposal (ACP): Add
File
constructors that nudge people toward buffered I/O libs-team#446 - Implementation: Add
File
constructors that return files wrapped with a buffer #130803 - Final comment period (FCP)1
- Stabilization PR
Unresolved Questions
- None yet.