std-type
io::Error: describe a failed operation
An I/O error may originate in the OS or in a reader or writer implemented by an application. Use the kind for broad handling and keep context for diagnostics; message strings are not portable identifiers. Expected stdout (not executed): true Common mistake: Matching human-readable OS error messages for control flow.
Formal Syntax & Structure
rust syntaxrust
io::Error::new(kind, message); error.kind()Working Example
Example Snippetrust
fn main() { use std::io::{Error, ErrorKind}; let e = Error::new(ErrorKind::InvalidData, "invalid record"); println!("{}", e.kind() == ErrorKind::InvalidData);}