1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
/// Converts errors from their error type (of the submodule) to that of
/// an aaru::Error variant.
///
/// ```rust,ignore
/// use aaru::codec::error::CodecError;
/// aaru::impl_err!(CodecError, Codec);
/// ```
pub mod err_macro {
    #[macro_export]
    macro_rules! impl_err {
        ($from:ty, $variant:ident) => {
            impl From<$from> for crate::Error {
                fn from(value: $from) -> Self {
                    crate::Error::$variant(value)
                }
            }
        };
    }

    pub use impl_err;
}