Do simple reads from disk

This commit is contained in:
Dominik Werder
2021-04-01 09:02:04 +02:00
parent 6dbc7cb605
commit dd7c028a41
7 changed files with 104 additions and 28 deletions

View File

@@ -3,6 +3,22 @@ pub struct Error {
msg: String,
}
impl Error {
pub fn with_msg<S: Into<String>>(s: S) -> Self {
Self {
msg: s.into(),
}
}
}
impl From<String> for Error {
fn from(k: String) -> Self {
Self {
msg: k,
}
}
}
impl std::fmt::Display for Error {
fn fmt(&self, fmt: &mut std::fmt::Formatter) -> std::fmt::Result {
write!(fmt, "Error")