console-rs / dialoguer

Rust utility library for nice command line prompts and similar things
MIT License
1.31k stars 143 forks source link

Add conversion between error types #300

Closed jacobtread closed 7 months ago

jacobtread commented 8 months ago

Description

Implements From for Error for std::io::Error to allow the error type to be converted to a std::io::Error which makes it easier for those coming from the v0.10 version where it was using std::io::Error instead of a custom error type.

This makes it easier to deal with the error type for those in a console app who are already likely using std::io::Result as their return type (So they can use the try operator without having to map the error type).

Since the std::io::Error is flexible and can take any kind of error type as its cause. I've left a comment incase you decide to expand the error type to have more errors other than just std::io::Error

Changes