blob: 6358bfe063f7c5ec0f6d24ee1372f186ed5e8abe (
plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
|
use std::io;
pub trait IntoIOError {
fn ioerr(self) -> io::Error;
}
impl IntoIOError for String {
fn ioerr(self) -> io::Error {
io::Error::new(io::ErrorKind::Other, self)
}
}
impl IntoIOError for &str {
fn ioerr(self) -> io::Error {
io::Error::new(io::ErrorKind::Other, self)
}
}
impl IntoIOError for std::string::FromUtf8Error {
fn ioerr(self) -> io::Error {
io::Error::new(io::ErrorKind::Other, self)
}
}
|