add InProgress ErrorKind gated behind io_error_inprogress feature

Co-authored-by: David Tolnay <dtolnay@gmail.com>
Co-authored-by: nora <48135649+Noratrieb@users.noreply.github.com>
This commit is contained in:
Aviram Hassan 2024-09-24 18:52:54 +03:00
parent 4cbfcf1b7f
commit 46fd76e9a5
No known key found for this signature in database
GPG key ID: 6BE9D82B0E6D1368
3 changed files with 8 additions and 0 deletions

View file

@ -400,6 +400,11 @@ pub enum ErrorKind {
#[stable(feature = "out_of_memory_error", since = "1.54.0")]
OutOfMemory,
/// The operation was partially successful and needs to be checked
/// later on due to not blocking.
#[unstable(feature = "io_error_inprogress", issue = "none")]
InProgress,
// "Unusual" error kinds which do not correspond simply to (sets
// of) OS error codes, should be added just above this comment.
// `Other` and `Uncategorized` should remain at the end:
@ -449,6 +454,7 @@ pub(crate) fn as_str(&self) -> &'static str {
FilesystemQuotaExceeded => "filesystem quota exceeded",
HostUnreachable => "host unreachable",
Interrupted => "operation interrupted",
InProgress => "in progress",
InvalidData => "invalid data",
InvalidFilename => "invalid filename",
InvalidInput => "invalid input parameter",

View file

@ -348,6 +348,7 @@ macro_rules! from_prim {
UnexpectedEof,
Unsupported,
OutOfMemory,
InProgress,
Uncategorized,
})
}

View file

@ -279,6 +279,7 @@ pub fn decode_error_kind(errno: i32) -> ErrorKind {
libc::ETIMEDOUT => TimedOut,
libc::ETXTBSY => ExecutableFileBusy,
libc::EXDEV => CrossesDevices,
libc::EINPROGRESS => InProgress,
libc::EACCES | libc::EPERM => PermissionDenied,