pub struct IoError {
pub kind: IoErrorKind,
pub message: String,
pub os_error: Option<i32>,
pub source: Option<Box<IoError>>,
}Expand description
Serializable snapshot of a std::io::Error chain.
IoError captures the chain structure (as a tree of
snapshots) but does NOT preserve the original std::io::Error
identity. The forward conversion From<std::io::Error> walks
std::error::Error::source and recurses for each
std::io::Error link; nested non-io::Error sources are
stringified into IoErrorKind::Other.
The reverse conversion From<IoError> for std::io::Error
is explicitly lossy — see IoError’s From impl.
Fields§
§kind: IoErrorKind§message: String§os_error: Option<i32>§source: Option<Box<IoError>>Trait Implementations§
Source§impl<'de> Deserialize<'de> for IoError
impl<'de> Deserialize<'de> for IoError
Source§fn deserialize<__D>(__deserializer: __D) -> Result<Self, __D::Error>where
__D: Deserializer<'de>,
fn deserialize<__D>(__deserializer: __D) -> Result<Self, __D::Error>where
__D: Deserializer<'de>,
impl Eq for IoError
Source§impl Error for IoError
impl Error for IoError
Source§fn source(&self) -> Option<&(dyn Error + 'static)>
fn source(&self) -> Option<&(dyn Error + 'static)>
1.0.0 · Source§fn description(&self) -> &str
fn description(&self) -> &str
use the Display impl or to_string()
Source§impl From<Error> for IoError
impl From<Error> for IoError
Source§fn from(err: Error) -> Self
fn from(err: Error) -> Self
Capture an io::Error chain as a tree of serializable
snapshots.
The implementation recursively walks the
std::error::Error::source chain on BORROWED
&dyn Error references. This is critical: std::io::Error
is not Clone, so we cannot reconstruct an inner error
from a borrow without losing its raw_os_error() and its
own source chain. Walking the borrow preserves the chain
STRUCTURE exactly.
At each level: if the source is itself an io::Error,
recurse on its borrow; otherwise, capture the source as
an IoErrorKind::Other snapshot (preserving the
Display text and walking its own source chain for
nested non-io links).
Source§impl From<IoError> for Error
impl From<IoError> for Error
Source§fn from(snapshot: IoError) -> Self
fn from(snapshot: IoError) -> Self
Reverse conversion is explicitly lossy.
The implementation prefers [std::io::Error::from_raw_os_error]
when IoError::os_error is Some, which LOSES the
snapshot message and any source chain. Otherwise, it
constructs a new io::Error::new(kind, message), which
loses raw_os_error().
The forward conversion (From<std::io::Error> for
IoError) preserves chain STRUCTURE; this reverse
conversion does not — the snapshot tree is collapsed to a
single std::io::Error.