std::error::Error is Rust’s standard trait for errors that provide descriptions and can optionally expose source errors. It gives different error types a common interface, which is useful when one function must handle failures from several dependencies. section 8.5.2
A practical pattern is to define an enum containing each upstream error, derive Debug, implement Display, and then implement Error. The wrapper preserves the original error variants instead of erasing them behind Box<dyn Error>. section 8.5.2
Combining file and address-parsing errors
A function can return Result<(), UpstreamError> while opening a file and parsing "::1". With map_err(), each failure becomes IO or Parsing; with From implementations, both operations can use ?. A missing file then reports the preserved IO variant.


