Skip to content

Add fs::read_to_string #34857

Closed
Closed
@brson

Description

@brson

Every time I want to load the contents of a file to a String I 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 be File::open(path)?.read_to_string()?, assuming you've got the Read trait 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.

Metadata

Metadata

Assignees

No one assigned

    Labels

    C-enhancementCategory: An issue proposing an enhancement or a PR with one.P-lowLow priorityT-libs-apiRelevant to the library API team, which will review and decide on the PR/issue.

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions