Skip to main content

rns_git/
lib.rs

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