Skip to main content

rns_git/
lib.rs

1pub mod acl;
2pub mod client;
3pub mod config;
4pub mod git;
5mod highlight;
6pub mod logging;
7pub mod pages;
8pub mod protocol;
9pub mod release;
10pub mod release_cli;
11pub mod server;
12mod stats;
13pub mod util;
14pub mod work;
15pub mod work_cli;
16
17pub type Result<T> = std::result::Result<T, Error>;
18
19#[derive(Debug)]
20pub enum Error {
21    Io(std::io::Error),
22    Msg(String),
23}
24
25impl Error {
26    pub fn msg(message: impl Into<String>) -> Self {
27        Error::Msg(message.into())
28    }
29}
30
31impl From<std::io::Error> for Error {
32    fn from(err: std::io::Error) -> Self {
33        Error::Io(err)
34    }
35}
36
37impl std::fmt::Display for Error {
38    fn fmt(&self, f: &mut std::fmt::Formatter<'_>) -> std::fmt::Result {
39        match self {
40            Error::Io(err) => write!(f, "{err}"),
41            Error::Msg(message) => write!(f, "{message}"),
42        }
43    }
44}
45
46impl std::error::Error for Error {}