Macro impl_array_newtype now generates method for representing data as array

This commit is contained in:
Igor Aleksanov 2018-05-16 12:31:59 +03:00
parent 6f3c7e19dd
commit 5df8893ea1
1 changed files with 4 additions and 0 deletions

View File

@ -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 {