From 6f22e4f13c42f06b686a01fbdd28a0163e88ae77 Mon Sep 17 00:00:00 2001 From: Laurenz Date: Fri, 11 Oct 2019 20:28:22 +0200 Subject: =?UTF-8?q?Render=20debug=20boxes=20=F0=9F=A7=AD?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- src/error.rs | 48 ------------------------------------------------ 1 file changed, 48 deletions(-) delete mode 100644 src/error.rs (limited to 'src/error.rs') diff --git a/src/error.rs b/src/error.rs deleted file mode 100644 index 514eb1a8..00000000 --- a/src/error.rs +++ /dev/null @@ -1,48 +0,0 @@ -//! Error handling. - -/// Create an error type. -macro_rules! error_type { - ( // The variable used instead of self in functions - // followed by the error type things are happening on. - $var:ident: $err:ident, - // Optionally the name of a result type to generate. - $(res: $res:ident,)* - // A `Display` and `Debug` implementation. - show: $f:ident => $show:expr, - // Optionally a `source` function for the `std::error::Error` trait. - $(source: $source:expr,)* - // Any number of `From` implementations. - $(from: ($from:path, $conv:expr),)* - ) => { - // Possibly create a result type. - $(type $res = std::result::Result;)* - - impl std::fmt::Display for $err { - fn fmt(&self, $f: &mut std::fmt::Formatter) -> std::fmt::Result { - let $var = self; - $show - } - } - - impl std::fmt::Debug for $err { - fn fmt(&self, f: &mut std::fmt::Formatter) -> std::fmt::Result { - std::fmt::Display::fmt(self, f) - } - } - - impl std::error::Error for $err { - // The source method is only generated if an implementation was given. - $(fn source(&self) -> Option<&(dyn std::error::Error + 'static)> { - let $var = self; - $source - })* - } - - // Create any number of from implementations. - $(impl From<$from> for $err { - fn from($var: $from) -> $err { - $conv - } - })* - }; -} -- cgit v1.2.3