use std::io; pub trait ToIOError { fn to_io_error(self) -> io::Error; } impl ToIOError for git2::Error { fn to_io_error(self) -> io::Error { io::Error::new(io::ErrorKind::Other, self) } } pub trait ToIOResult { fn to_io_result(self) -> io::Result; } impl ToIOResult for std::result::Result { fn to_io_result(self) -> io::Result { self.map_err(|e| e.to_io_error()) } }