-
Notifications
You must be signed in to change notification settings - Fork 13.4k
Document possible io::ErrorKind
s of fs::open
#42925
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Merged
Merged
Changes from 1 commit
Commits
Show all changes
2 commits
Select commit
Hold shift + click to select a range
File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -653,15 +653,29 @@ impl OpenOptions { | |
/// # Errors | ||
/// | ||
/// This function will return an error under a number of different | ||
/// circumstances, to include but not limited to: | ||
/// | ||
/// * Opening a file that does not exist without setting `create` or | ||
/// `create_new`. | ||
/// * Attempting to open a file with access that the user lacks | ||
/// permissions for | ||
/// * Filesystem-level errors (full disk, etc) | ||
/// * Invalid combinations of open options (truncate without write access, | ||
/// no access mode set, etc) | ||
/// circumstances. Some of these error conditions are listed here, together | ||
/// with their [`ErrorKind`]. The mapping to `ErrorKind`s is not part of | ||
/// the compatiblity contract of the function, especially the `Other` kind | ||
/// might change to more specific kinds in the future. | ||
/// | ||
/// * `NotFound`: The specified file does not exist and neither `create` or | ||
/// `create_new` is set, | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. This should end in a period |
||
/// * `NotFound`: One of the directory components of the file path does not | ||
/// exist. | ||
/// * `PermissionDenied`: The user lacks permission to get the specified | ||
/// access rights for the file. | ||
/// * `PermissionDenied`: The user lacks permission to open one of the | ||
/// directory components of the specified path. | ||
/// * `AlreadyExists`: `create_new` was specified and the file already | ||
/// exists. | ||
/// * `InvalidInput`: Invalid combinations of open options (truncate | ||
/// without write access, no access mode set, etc.). | ||
/// * `Other`: One of the directory components of the specified file path | ||
/// was not, in fact, a directory. | ||
/// * `Other`: Filesystem-level errors: full disk, write permission | ||
/// requested on a read-only file system, exceeded disk quota, too many | ||
/// open files, too long filename, too many symbolic links in the | ||
/// specified path (Unix-like systems only), etc. | ||
/// | ||
/// # Examples | ||
/// | ||
|
@@ -670,6 +684,8 @@ impl OpenOptions { | |
/// | ||
/// let file = OpenOptions::new().open("foo.txt"); | ||
/// ``` | ||
/// | ||
/// [`ErrorKind`]: ../io/enum.ErrorKind.html | ||
#[stable(feature = "rust1", since = "1.0.0")] | ||
pub fn open<P: AsRef<Path>>(&self, path: P) -> io::Result<File> { | ||
self._open(path.as_ref()) | ||
|
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Missing link to the second
ErrorKind
.