Skip to content

Document ErrorKind for create_new failed due to file already exists #119244

Closed
@anatawa12

Description

@anatawa12

Location

https://doc.rust-lang.org/std/fs/struct.OpenOptions.html#method.create_new

Summary

With create_new option, we can create files if not exists and fail to create if already exists or fail with other general errors such as permission errors.

I want to retry with another file name if the failure is because file is already exists but there are no documentation about error kind in create_new.
I think the error kind for create_new failure due to file already exists is AlreadyExists.
I think it's better to document that in create_new.

Metadata

Metadata

Assignees

No one assigned

    Labels

    A-docsArea: Documentation for any part of the project, including the compiler, standard library, and toolsT-libsRelevant to the library 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