refactor: make everything a little more modular

This commit is contained in:
VC
2022-04-22 13:36:02 +02:00
parent de375b9f28
commit 080218f385
11 changed files with 478 additions and 323 deletions

27
src/error.rs Normal file
View File

@@ -0,0 +1,27 @@
use std::fmt;
#[derive(Debug)]
pub struct ScootalooError {
details: String,
}
impl ScootalooError {
pub fn new(msg: &str) -> ScootalooError {
ScootalooError {
details: String::from(msg),
}
}
}
impl fmt::Display for ScootalooError {
fn fmt(&self, f: &mut fmt::Formatter) -> fmt::Result {
write!(f, "{}", self.details)
}
}
impl std::error::Error for ScootalooError {
fn description(&self) -> &str {
&self.details
}
}