WIP on simple disk serve

This commit is contained in:
Dominik Werder
2021-03-31 22:17:54 +02:00
commit 6dbc7cb605
14 changed files with 359 additions and 0 deletions

10
err/Cargo.toml Normal file
View File

@@ -0,0 +1,10 @@
[package]
name = "err"
version = "0.0.1-a.0"
authors = ["Dominik Werder <dominik.werder@gmail.com>"]
edition = "2018"
[dependencies]
hyper = { version = "0.14", features = ["http1", "http2", "client", "server", "tcp"] }
http = "0.2"
serde_json = "1.0"

45
err/src/lib.rs Normal file
View File

@@ -0,0 +1,45 @@
#[derive(Debug)]
pub struct Error {
msg: String,
}
impl std::fmt::Display for Error {
fn fmt(&self, fmt: &mut std::fmt::Formatter) -> std::fmt::Result {
write!(fmt, "Error")
}
}
impl std::error::Error for Error {
}
impl From<std::io::Error> for Error {
fn from (k: std::io::Error) -> Self {
Self {
msg: k.to_string(),
}
}
}
impl From<http::Error> for Error {
fn from (k: http::Error) -> Self {
Self {
msg: k.to_string(),
}
}
}
impl From<hyper::Error> for Error {
fn from (k: hyper::Error) -> Self {
Self {
msg: k.to_string(),
}
}
}
impl From<serde_json::Error> for Error {
fn from (k: serde_json::Error) -> Self {
Self {
msg: k.to_string(),
}
}
}