use std::io; pub trait IntoIOError { fn ioerr(self) -> io::Error; } // This impl bound is taken directly from the io::Error::new function. impl>> IntoIOError for E { fn ioerr(self) -> io::Error { io::Error::new(io::ErrorKind::Other, self) } }