linux_proc/
lib.rs

1//! Parsers for the contents of the `/proc` directory.
2//!
3
4pub mod diskstats;
5pub mod stat;
6pub mod uptime;
7mod util;
8
9use std::fmt;
10
11/// A very simple error handler.
12pub struct Error(String);
13
14impl From<String> for Error {
15    fn from(f: String) -> Error {
16        Error(f)
17    }
18}
19
20impl<'a> From<&'a str> for Error {
21    fn from(f: &str) -> Error {
22        Error(f.into())
23    }
24}
25
26impl fmt::Debug for Error {
27    fn fmt(&self, f: &mut fmt::Formatter) -> fmt::Result {
28        fmt::Debug::fmt(&self.0, f)
29    }
30}
31
32impl fmt::Display for Error {
33    fn fmt(&self, f: &mut fmt::Formatter) -> fmt::Result {
34        fmt::Display::fmt(&self.0, f)
35    }
36}
37
38impl std::error::Error for Error {}