eejit 0.2.1

A self-hosted Git server that's easy to set up, use, and maintain.
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
use anyhow::anyhow;
use russh::CryptoVec;

pub trait CustomContext<T> {
    fn context(self, context: &str) -> anyhow::Result<T>;
}

impl<T> CustomContext<T> for Result<T, ()> {
    fn context(self, context: &str) -> anyhow::Result<T> {
        self.map_err(|_| anyhow!(context.to_string()))
    }
}

impl<T> CustomContext<T> for Result<T, CryptoVec> {
    fn context(self, context: &str) -> anyhow::Result<T> {
        self.map_err(|e| anyhow!(context.to_string()).context(format!("{:?}", e)))
    }
}