diff --git a/fixed-hash/src/hash.rs b/fixed-hash/src/hash.rs index 156f828..f02c59d 100644 --- a/fixed-hash/src/hash.rs +++ b/fixed-hash/src/hash.rs @@ -51,6 +51,13 @@ macro_rules! construct_hash { } } + impl AsRef<$from> for $from { + #[inline] + fn as_ref(&self) -> &$from { + &self + } + } + impl ::core::ops::DerefMut for $from { #[inline] fn deref_mut(&mut self) -> &mut [u8] { diff --git a/uint/src/uint.rs b/uint/src/uint.rs index c807d2c..0dd9dc8 100644 --- a/uint/src/uint.rs +++ b/uint/src/uint.rs @@ -551,6 +551,12 @@ macro_rules! construct_uint { #[derive(Copy, Clone, Eq, PartialEq, Hash)] pub struct $name(pub [u64; $n_words]); + impl AsRef<$name> for $name { + fn as_ref(&self) -> &$name { + &self + } + } + impl $name { /// Convert from a decimal string. pub fn from_dec_str(value: &str) -> Result {