pub struct IoError(/* private fields */);
Expand description
A version of
std::io::Error
implemented on top of
Arc
instead of
Box
,
making it cloneable.
The API of this type has been designed to match
io::Error
, with
two exceptions:
IoError::new
andIoError::into_inner
substituteArc
forBox
, andIoError
has no equivalent toio::Error::get_mut
, as the inner error instance is shared.
See the standard library documentation for more detailed API-level descriptions than are given here.
IoError
implements
From
for io::Error
and vice-versa, so the two types can easily be converted between each other.
A type containing
io::Error
can
be made
Clone
-compatible
by instead storing IoError
internally and
converting from/to
io::Error
on
API boundaries.
Clones derived from the same original IoError
instance will share a single heap-allocated error instance (if one is
present) using
Arc
.
io::Error
instances produced by converting those clones back with the
From
implementation will also share the same single error instance.
Implementations§
Source§impl IoError
impl IoError
Sourcepub fn new<E>(kind: IoErrorKind, error: E) -> Self
pub fn new<E>(kind: IoErrorKind, error: E) -> Self
See
io::Error::new
,
with
Arc
substituted for
Box
.
Sourcepub fn last_os_error() -> Self
pub fn last_os_error() -> Self
Sourcepub fn from_raw_os_error(code: i32) -> Self
pub fn from_raw_os_error(code: i32) -> Self
Sourcepub fn raw_os_error(&self) -> Option<i32>
pub fn raw_os_error(&self) -> Option<i32>
Sourcepub fn into_inner(self) -> Option<Arc<dyn Error + Send + Sync>>
pub fn into_inner(self) -> Option<Arc<dyn Error + Send + Sync>>
See
io::Error::into_inner
,
with
Arc
substituted for
Box
.
Sourcepub fn kind(&self) -> IoErrorKind
pub fn kind(&self) -> IoErrorKind
See
io::Error::kind
.