Merge pull request #219 from TheBlueMatt/master
Expose the underlying array in addition to a ptr to the same
This commit is contained in:
commit
c9741d4846
|
@ -34,6 +34,13 @@ macro_rules! impl_array_newtype {
|
|||
dat.as_mut_ptr()
|
||||
}
|
||||
|
||||
#[inline]
|
||||
/// Gets a reference to the underlying array
|
||||
pub fn as_ref(&self) -> &[$ty; $len] {
|
||||
let &$thing(ref dat) = self;
|
||||
dat
|
||||
}
|
||||
|
||||
#[inline]
|
||||
/// Returns the length of the object as an array
|
||||
pub fn len(&self) -> usize { $len }
|
||||
|
|
Loading…
Reference in New Issue