Macro trackable::derive_traits_for_trackable_error_newtype [−][src]
macro_rules! derive_traits_for_trackable_error_newtype { ($error:ident, $kind:ty) => { ... }; }
Implements the typical traits for a newtype $error of TrackableError<$kind>
.
The automatically implemented traits are Deref
, From
, Display
, Error
,
Trackable
and From
.
This macro is useful to reduce the boilerplate code when you define a your own trackable error type.
Examples
use trackable::error::{TrackableError, ErrorKind as TrackableErrorKind}; #[derive(Debug, Clone, PartialEq, Eq)] pub enum ErrorKind { Foo, Bar, Baz, } impl TrackableErrorKind for ErrorKind {} // Defines a newtype of `TrackableError<ErrorKind>`. #[derive(Debug, Clone)] pub struct Error(TrackableError<ErrorKind>); derive_traits_for_trackable_error_newtype!(Error, ErrorKind);