atomic_write/
error.rs

1use std::fmt;
2
3#[derive(Debug)]
4pub struct Error {
5    message: String,
6}
7
8impl fmt::Display for Error {
9    fn fmt(&self, f: &mut fmt::Formatter) -> fmt::Result {
10        write!(f, "{}", self)
11    }
12}
13
14impl std::error::Error for Error {}
15
16impl From<nix::Error> for Error {
17    fn from(e: nix::Error) -> Self {
18        Error {
19            message: format!("{}", e),
20        }
21    }
22}
23
24impl From<std::io::Error> for Error {
25    fn from(e: std::io::Error) -> Self {
26        Error {
27            message: format!("{}", e),
28        }
29    }
30}