From 5df8893ea120349b8e58d9c9640fed0dfcd513e4 Mon Sep 17 00:00:00 2001 From: Igor Aleksanov Date: Wed, 16 May 2018 12:31:59 +0300 Subject: [PATCH] Macro impl_array_newtype now generates method for representing data as array --- src/internal_macros.rs | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/src/internal_macros.rs b/src/internal_macros.rs index 351693cc..82905b16 100644 --- a/src/internal_macros.rs +++ b/src/internal_macros.rs @@ -77,6 +77,10 @@ macro_rules! impl_array_newtype { #[inline] /// Returns whether the object, as an array, is empty. Always false. pub fn is_empty(&self) -> bool { false } + + #[inline] + /// Returns the underlying data. + pub fn data(&self) -> [$ty; $len] { self.0.clone() } } impl<'a> From<&'a [$ty]> for $thing {