1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
12
13
//! Macros shared throughout the implementation

/// Macro to automatically provide an `AsRef<[u8]>` implementation
/// for newtypes that wrap a byte array.
macro_rules! as_ref_bytes_newtype {
    ($newtype:ty) => {
        impl AsRef<[u8]> for $newtype {
            fn as_ref(&self) -> &[u8] {
                &self.0
            }
        }
    };
}