-
Notifications
You must be signed in to change notification settings - Fork 13.7k
Closed
Labels
C-feature-requestCategory: A feature request, i.e: not implemented / a PR.Category: A feature request, i.e: not implemented / a PR.T-libs-apiRelevant to the library API team, which will review and decide on the PR/issue.Relevant to the library API team, which will review and decide on the PR/issue.
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());
pitdicker, Herohtar and Demiumcarton
Metadata
Metadata
Assignees
Labels
C-feature-requestCategory: A feature request, i.e: not implemented / a PR.Category: A feature request, i.e: not implemented / a PR.T-libs-apiRelevant to the library API team, which will review and decide on the PR/issue.Relevant to the library API team, which will review and decide on the PR/issue.