WIP on simple disk serve
This commit is contained in:
10
err/Cargo.toml
Normal file
10
err/Cargo.toml
Normal 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
45
err/src/lib.rs
Normal 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(),
|
||||
}
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user