error: implement From<Error> for io::Error
This commit is contained in:
parent
1fc224fbae
commit
316778ccd9
@ -1,4 +1,5 @@
|
|||||||
use std::error;
|
use std::error;
|
||||||
|
use std::io;
|
||||||
use std::fmt;
|
use std::fmt;
|
||||||
use std::ffi::CStr;
|
use std::ffi::CStr;
|
||||||
use std::str::from_utf8_unchecked;
|
use std::str::from_utf8_unchecked;
|
||||||
@ -110,6 +111,12 @@ impl Into<c_int> for Error {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
impl From<Error> for io::Error {
|
||||||
|
fn from(value: Error) -> io::Error {
|
||||||
|
io::Error::new(io::ErrorKind::Other, value)
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
impl fmt::Display for Error {
|
impl fmt::Display for Error {
|
||||||
fn fmt(&self, f: &mut fmt::Formatter) -> Result<(), fmt::Error> {
|
fn fmt(&self, f: &mut fmt::Formatter) -> Result<(), fmt::Error> {
|
||||||
f.write_str(error::Error::description(self))
|
f.write_str(error::Error::description(self))
|
||||||
|
Loading…
x
Reference in New Issue
Block a user