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