diff options
author | Daniel Schadt <kingdread@gmx.de> | 2020-04-04 13:48:56 +0200 |
---|---|---|
committer | Daniel Schadt <kingdread@gmx.de> | 2020-04-04 13:55:20 +0200 |
commit | 4ec62bbac872bbfd95413af2f00c3f4a36c70630 (patch) | |
tree | 22cac1ff6f9776565d9f35322c463ec6125c0bc7 /src/lib.rs | |
parent | 22738da2cd36b4ae2e1fb5efd23373e6b77405a2 (diff) | |
download | evtclib-4ec62bbac872bbfd95413af2f00c3f4a36c70630.tar.gz evtclib-4ec62bbac872bbfd95413af2f00c3f4a36c70630.tar.bz2 evtclib-4ec62bbac872bbfd95413af2f00c3f4a36c70630.zip |
switch from quick_error to thiserror
thiserror seems to be the more modern approach that also works with the
new Error trait from std.
Diffstat (limited to 'src/lib.rs')
-rw-r--r-- | src/lib.rs | 24 |
1 files changed, 9 insertions, 15 deletions
@@ -18,11 +18,12 @@ //! module](raw/parser/index.html#buffering)) #![feature(try_trait, stmt_expr_attributes, never_type)] #[macro_use] -extern crate quick_error; -#[macro_use] extern crate num_derive; #[macro_use] extern crate getset; + +use thiserror::Error; + pub mod raw; mod event; @@ -55,19 +56,12 @@ macro_rules! matches { ); } -quick_error! { - #[derive(Debug)] - pub enum EvtcError { - InvalidData { - description("invalid data has been provided") - } - Utf8Error(err: ::std::string::FromUtf8Error) { - from() - description("utf8 decoding error") - display("UTF-8 decoding error: {}", err) - cause(err) - } - } +#[derive(Error, Debug)] +pub enum EvtcError { + #[error("invalid data has been provided")] + InvalidData, + #[error("utf8 decoding error: {0}")] + Utf8Error(#[from] std::string::FromUtf8Error), } /// The type of an agent. |