From 3d43653d9f1e9feba45844b2adbe706d0cf96e36 Mon Sep 17 00:00:00 2001 From: debris Date: Wed, 21 Feb 2018 14:09:10 +0100 Subject: [PATCH] impl AsRef for primitives --- src/uint.rs | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/src/uint.rs b/src/uint.rs index c807d2c..0dd9dc8 100644 --- a/src/uint.rs +++ b/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 {