From e8d3e3c4f69fc5bab2b32b16b7c8c2c4a8a89a4b Mon Sep 17 00:00:00 2001 From: troido Date: Mon, 6 Apr 2020 10:37:53 +0200 Subject: made parseerrors their own thing --- src/util.rs | 36 ------------------------------------ 1 file changed, 36 deletions(-) (limited to 'src/util.rs') diff --git a/src/util.rs b/src/util.rs index a5aca1a..c9557b2 100644 --- a/src/util.rs +++ b/src/util.rs @@ -1,46 +1,10 @@ -use std::error::Error; -use std::fmt::{Display, Formatter}; use std::cmp::{min, max}; pub fn clamp(val: T, lower: T, upper: T) -> T{ max(min(val, upper), lower) } -pub type AnyError = Box; -pub type Result = std::result::Result; - -#[derive(Debug)] -pub struct AError { - text: String -} - -impl AError { - pub fn new(txt: &str) -> Self{ - AError { - text: txt.to_string() - } - } -} - -impl Error for AError { - fn source(&self) -> Option<&(dyn Error + 'static)> { - None - } -} - -impl Display for AError { - fn fmt(&self, f: &mut Formatter<'_>) -> std::fmt::Result { - write!(f, "Error: {}", self.text) - } -} - - -#[macro_export] -macro_rules! aerr { - ($($description:tt)*) => {Box::new(crate::util::AError::new(&format!($($description)*)))} -} - #[macro_export] macro_rules! hashmap { -- cgit