#[non_exhaustive]pub enum IoErrorKind {
Show 41 variants
NotFound,
PermissionDenied,
ConnectionRefused,
ConnectionReset,
HostUnreachable,
NetworkUnreachable,
ConnectionAborted,
NotConnected,
AddrInUse,
AddrNotAvailable,
NetworkDown,
BrokenPipe,
AlreadyExists,
WouldBlock,
NotADirectory,
IsADirectory,
DirectoryNotEmpty,
ReadOnlyFilesystem,
FilesystemLoop,
StaleNetworkFileHandle,
InvalidInput,
InvalidData,
TimedOut,
WriteZero,
StorageFull,
NotSeekable,
QuotaExceeded,
FileTooLarge,
ResourceBusy,
ExecutableFileBusy,
Deadlock,
CrossesDevices,
TooManyLinks,
InvalidFilename,
ArgumentListTooLong,
Interrupted,
Unsupported,
UnexpectedEof,
OutOfMemory,
InProgress,
Other,
}
Expand description
๐ฉ+
?std
A list specifying general categories of I/O error.
Re-exported from std
::io::
ErrorKind
โIoErrorKind
.
A list specifying general categories of I/O error.
This list is intended to grow over time and it is not recommended to exhaustively match against it.
It is used with the io::Error
type.
ยงHandling errors and matching on ErrorKind
In application code, use match
for the ErrorKind
values you are
expecting; use _
to match โall other errorsโ.
In comprehensive and thorough tests that want to verify that a test doesnโt
return any known incorrect error kind, you may want to cut-and-paste the
current full list of errors from here into your test code, and then match
_
as the correct case. This seems counterintuitive, but it will make your
tests more robust. In particular, if you want to verify that your code does
produce an unrecognized error kind, the robust solution is to check for all
the recognized error kinds and fail in those cases.
Variants (Non-exhaustive)ยง
This enum is marked as non-exhaustive
NotFound
An entity was not found, often a file.
PermissionDenied
The operation lacked the necessary privileges to complete.
ConnectionRefused
The connection was refused by the remote server.
ConnectionReset
The connection was reset by the remote server.
HostUnreachable
The remote host is not reachable.
NetworkUnreachable
The network containing the remote host is not reachable.
ConnectionAborted
The connection was aborted (terminated) by the remote server.
NotConnected
The network operation failed because it was not connected yet.
AddrInUse
A socket address could not be bound because the address is already in use elsewhere.
AddrNotAvailable
A nonexistent interface was requested or the requested address was not local.
NetworkDown
The systemโs networking is down.
BrokenPipe
The operation failed because a pipe was closed.
AlreadyExists
An entity already exists, often a file.
WouldBlock
The operation needs to block to complete, but the blocking operation was requested to not occur.
NotADirectory
A filesystem object is, unexpectedly, not a directory.
For example, a filesystem path was specified where one of the intermediate directory components was, in fact, a plain file.
IsADirectory
The filesystem object is, unexpectedly, a directory.
A directory was specified when a non-directory was expected.
DirectoryNotEmpty
A non-empty directory was specified where an empty directory was expected.
ReadOnlyFilesystem
The filesystem or storage medium is read-only, but a write operation was attempted.
FilesystemLoop
io_error_more
)Loop in the filesystem or IO subsystem; often, too many levels of symbolic links.
There was a loop (or excessively long chain) resolving a filesystem object or file IO object.
On Unix this is usually the result of a symbolic link loop; or, of exceeding the system-specific limit on the depth of symlink traversal.
StaleNetworkFileHandle
Stale network file handle.
With some network filesystems, notably NFS, an open file (or directory) can be invalidated by problems with the network or server.
InvalidInput
A parameter was incorrect.
InvalidData
Data not valid for the operation were encountered.
Unlike InvalidInput
, this typically means that the operation
parameters were valid, however the error was caused by malformed
input data.
For example, a function that reads a file into a string will error with
InvalidData
if the fileโs contents are not valid UTF-8.
TimedOut
The I/O operationโs timeout expired, causing it to be canceled.
WriteZero
An error returned when an operation could not be completed because a
call to write
returned Ok(0)
.
This typically means that an operation could only succeed if it wrote a particular number of bytes but only a smaller number of bytes could be written.
StorageFull
The underlying storage (typically, a filesystem) is full.
This does not include out of quota errors.
NotSeekable
Seek on unseekable file.
Seeking was attempted on an open file handle which is not suitable for seeking - for
example, on Unix, a named pipe opened with File::open
.
QuotaExceeded
Filesystem quota or some other kind of quota was exceeded.
FileTooLarge
File larger than allowed or supported.
This might arise from a hard limit of the underlying filesystem or file access API, or from an administratively imposed resource limitation. Simple disk full, and out of quota, have their own errors.
ResourceBusy
Resource is busy.
ExecutableFileBusy
Executable file is busy.
An attempt was made to write to a file which is also in use as a running program. (Not all operating systems detect this situation.)
Deadlock
Deadlock (avoided).
A file locking operation would result in deadlock. This situation is typically detected, if at all, on a best-effort basis.
CrossesDevices
Cross-device or cross-filesystem (hard) link or rename.
TooManyLinks
Too many (hard) links to the same filesystem object.
The filesystem does not support making so many hardlinks to the same file.
InvalidFilename
io_error_more
)A filename was invalid.
This error can also cause if it exceeded the filename length limit.
ArgumentListTooLong
Program argument list too long.
When trying to run an external program, a system or process limit on the size of the arguments would have been exceeded.
Interrupted
This operation was interrupted.
Interrupted operations can typically be retried.
Unsupported
This operation is unsupported on this platform.
This means that the operation can never succeed.
UnexpectedEof
An error returned when an operation could not be completed because an โend of fileโ was reached prematurely.
This typically means that an operation could only succeed if it read a particular number of bytes but only a smaller number of bytes could be read.
OutOfMemory
An operation could not be completed, because it failed to allocate enough memory.
InProgress
io_error_inprogress
)The operation was partially successful and needs to be checked later on due to not blocking.
Other
A custom error that does not fall under any other I/O error kind.
This can be used to construct your own Error
s that do not match any
ErrorKind
.
This ErrorKind
is not used by the standard library.
Errors from the standard library that do not fall under any of the I/O
error kinds cannot be match
ed on, and will only match a wildcard (_
) pattern.
New ErrorKind
s might be added in the future for some of those.
Trait Implementationsยง
1.60.0 ยท Sourceยงimpl Display for ErrorKind
impl Display for ErrorKind
Sourceยงfn fmt(&self, fmt: &mut Formatter<'_>) -> Result<(), Error> โ
fn fmt(&self, fmt: &mut Formatter<'_>) -> Result<(), Error> โ
Shows a human-readable description of the ErrorKind
.
This is similar to impl Display for Error
, but doesnโt require first converting to Error.
ยงExamples
use std::io::ErrorKind;
assert_eq!("entity not found", ErrorKind::NotFound.to_string());
1.14.0 ยท Sourceยงimpl From<ErrorKind> for Error
Intended for use for errors not exposed to the user, where allocating onto
the heap (for normal construction via Error::new) is too costly.
impl From<ErrorKind> for Error
Intended for use for errors not exposed to the user, where allocating onto the heap (for normal construction via Error::new) is too costly.
1.0.0 ยท Sourceยงimpl Ord for ErrorKind
impl Ord for ErrorKind
1.21.0 ยท Sourceยงfn max(self, other: Self) -> Selfwhere
Self: Sized,
fn max(self, other: Self) -> Selfwhere
Self: Sized,
1.0.0 ยท Sourceยงimpl PartialOrd for ErrorKind
impl PartialOrd for ErrorKind
impl Copy for ErrorKind
impl Eq for ErrorKind
impl StructuralPartialEq for ErrorKind
Auto Trait Implementationsยง
impl Freeze for ErrorKind
impl RefUnwindSafe for ErrorKind
impl Send for ErrorKind
impl Sync for ErrorKind
impl Unpin for ErrorKind
impl UnwindSafe for ErrorKind
Blanket Implementationsยง
ยงimpl<T> ArchivePointee for T
impl<T> ArchivePointee for T
ยงtype ArchivedMetadata = ()
type ArchivedMetadata = ()
ยงfn pointer_metadata(
_: &<T as ArchivePointee>::ArchivedMetadata,
) -> <T as Pointee>::Metadata
fn pointer_metadata( _: &<T as ArchivePointee>::ArchivedMetadata, ) -> <T as Pointee>::Metadata
Sourceยงimpl<T> BorrowMut<T> for Twhere
T: ?Sized,
impl<T> BorrowMut<T> for Twhere
T: ?Sized,
Sourceยงfn borrow_mut(&mut self) -> &mut T
fn borrow_mut(&mut self) -> &mut T
Sourceยงimpl<T> ByteSized for T
impl<T> ByteSized for T
Sourceยงconst BYTE_ALIGN: usize = _
const BYTE_ALIGN: usize = _
Sourceยงfn byte_align(&self) -> usize โ
fn byte_align(&self) -> usize โ
Sourceยงfn ptr_size_ratio(&self) -> [usize; 2]
fn ptr_size_ratio(&self) -> [usize; 2]
Sourceยงimpl<T, R> Chain<R> for Twhere
T: ?Sized,
impl<T, R> Chain<R> for Twhere
T: ?Sized,
Sourceยงimpl<T> CloneToUninit for Twhere
T: Clone,
impl<T> CloneToUninit for Twhere
T: Clone,
ยงimpl<Q, K> Comparable<K> for Q
impl<Q, K> Comparable<K> for Q
ยงimpl<Q, K> Equivalent<K> for Q
impl<Q, K> Equivalent<K> for Q
ยงfn equivalent(&self, key: &K) -> bool
fn equivalent(&self, key: &K) -> bool
key
and return true
if they are equal.Sourceยงimpl<T> ExtAny for T
impl<T> ExtAny for T
Sourceยงfn as_any_mut(&mut self) -> &mut dyn Anywhere
Self: Sized,
fn as_any_mut(&mut self) -> &mut dyn Anywhere
Self: Sized,
Sourceยงimpl<T> ExtMem for Twhere
T: ?Sized,
impl<T> ExtMem for Twhere
T: ?Sized,
Sourceยงconst NEEDS_DROP: bool = _
const NEEDS_DROP: bool = _
Sourceยงfn mem_align_of<T>() -> usize โ
fn mem_align_of<T>() -> usize โ
Sourceยงfn mem_align_of_val(&self) -> usize โ
fn mem_align_of_val(&self) -> usize โ
Sourceยงfn mem_size_of_val(&self) -> usize โ
fn mem_size_of_val(&self) -> usize โ
Sourceยงfn mem_needs_drop(&self) -> bool
fn mem_needs_drop(&self) -> bool
true
if dropping values of this type matters. Read moreSourceยงfn mem_forget(self)where
Self: Sized,
fn mem_forget(self)where
Self: Sized,
self
without running its destructor. Read moreSourceยงfn mem_replace(&mut self, other: Self) -> Selfwhere
Self: Sized,
fn mem_replace(&mut self, other: Self) -> Selfwhere
Self: Sized,
Sourceยงunsafe fn mem_zeroed<T>() -> T
unsafe fn mem_zeroed<T>() -> T
unsafe_layout
only.T
represented by the all-zero byte-pattern. Read moreSourceยงunsafe fn mem_transmute_copy<Src, Dst>(src: &Src) -> Dst
unsafe fn mem_transmute_copy<Src, Dst>(src: &Src) -> Dst
unsafe_layout
only.T
represented by the all-zero byte-pattern. Read moreSourceยงfn mem_as_bytes(&self) -> &[u8] โ
fn mem_as_bytes(&self) -> &[u8] โ
unsafe_slice
only.ยงimpl<S> FromSample<S> for S
impl<S> FromSample<S> for S
fn from_sample_(s: S) -> S
Sourceยงimpl<T> Hook for T
impl<T> Hook for T
ยงimpl<T> Instrument for T
impl<T> Instrument for T
ยงfn instrument(self, span: Span) -> Instrumented<Self> โ
fn instrument(self, span: Span) -> Instrumented<Self> โ
ยงfn in_current_span(self) -> Instrumented<Self> โ
fn in_current_span(self) -> Instrumented<Self> โ
Sourceยงimpl<T> IntoEither for T
impl<T> IntoEither for T
Sourceยงfn into_either(self, into_left: bool) -> Either<Self, Self> โ
fn into_either(self, into_left: bool) -> Either<Self, Self> โ
self
into a Left
variant of Either<Self, Self>
if into_left
is true
.
Converts self
into a Right
variant of Either<Self, Self>
otherwise. Read moreSourceยงfn into_either_with<F>(self, into_left: F) -> Either<Self, Self> โ
fn into_either_with<F>(self, into_left: F) -> Either<Self, Self> โ
self
into a Left
variant of Either<Self, Self>
if into_left(&self)
returns true
.
Converts self
into a Right
variant of Either<Self, Self>
otherwise. Read moreยงimpl<F, T> IntoSample<T> for Fwhere
T: FromSample<F>,
impl<F, T> IntoSample<T> for Fwhere
T: FromSample<F>,
fn into_sample(self) -> T
ยงimpl<T> LayoutRaw for T
impl<T> LayoutRaw for T
ยงfn layout_raw(_: <T as Pointee>::Metadata) -> Result<Layout, LayoutError> โ
fn layout_raw(_: <T as Pointee>::Metadata) -> Result<Layout, LayoutError> โ
ยงimpl<T, N1, N2> Niching<NichedOption<T, N1>> for N2
impl<T, N1, N2> Niching<NichedOption<T, N1>> for N2
ยงunsafe fn is_niched(niched: *const NichedOption<T, N1>) -> bool
unsafe fn is_niched(niched: *const NichedOption<T, N1>) -> bool
ยงfn resolve_niched(out: Place<NichedOption<T, N1>>)
fn resolve_niched(out: Place<NichedOption<T, N1>>)
out
indicating that a T
is niched.