-
-
Notifications
You must be signed in to change notification settings - Fork 15k
Add fs::read_to_string #34857
Copy link
Copy link
Closed
Labels
C-enhancementCategory: An issue proposing an enhancement or a PR with one.Category: An issue proposing an enhancement or a PR with one.P-lowLow priorityLow priorityT-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.
Metadata
Metadata
Assignees
Labels
C-enhancementCategory: An issue proposing an enhancement or a PR with one.Category: An issue proposing an enhancement or a PR with one.P-lowLow priorityLow priorityT-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.
Type
Fields
Give feedbackNo fields configured for issues without a type.
Every time I want to load the contents of a file to a
StringI think this same thing: "there should be a fs::read_to_string".It looks like to me the most convenient way to do this once
?is stable (which doesn't seem to be near) might beFile::open(path)?.read_to_string()?, assuming you've got theReadtrait imported. It's just not as nice.We as @rust-lang/libs can be more aggressive about identifying and adding simple ergonomic improvements like this.