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) } }