Closed
Description
The current way to open a file is this:
File::open("foo.txt")
But if you want to open a file in with any options you do this:
use std::fs::OpenOptions;
let mut file = OpenOptions::new()
.read(true)
.write(true)
.open("foo.txt");
It's weird that the options object does the actual opening. I propose that we deprecate OpenOptions::open()
and add File::open_with(path: &str, options: &OpenOptions)
.
let mut file = File::open_with("foo.txt", OpenOptions::new().read().write());