From ac2bba01cf1083caaf4a6412a4291775e86221ae Mon Sep 17 00:00:00 2001 From: Brendan Zabarauskas Date: Sat, 14 Nov 2015 12:20:09 +1100 Subject: [PATCH] Make pointer access function names match those in std --- src/array.rs | 12 ++++++++---- 1 file changed, 8 insertions(+), 4 deletions(-) diff --git a/src/array.rs b/src/array.rs index 128edf2..cd0edc3 100644 --- a/src/array.rs +++ b/src/array.rs @@ -28,12 +28,14 @@ pub trait Array1 where type Element: Copy; /// Get the pointer to the first element of the array. - fn ptr<'a>(&'a self) -> &'a Self::Element { + #[inline] + fn as_ptr(&self) -> *const Self::Element { &self[0] } /// Get a mutable pointer to the first element of the array. - fn mut_ptr<'a>(&'a mut self) -> &'a mut Self::Element { + #[inline] + fn as_mut_ptr(&mut self) -> *mut Self::Element { &mut self[0] } @@ -74,12 +76,14 @@ pub trait Array2 where type Row: Array1; /// Get the pointer to the first element of the array. - fn ptr<'a>(&'a self) -> &'a Self::Element { + #[inline] + fn as_ptr(&self) -> *const Self::Element { &self[0][0] } /// Get a mutable pointer to the first element of the array. - fn mut_ptr<'a>(&'a mut self) -> &'a mut Self::Element { + #[inline] + fn as_mut_ptr(&mut self) -> *mut Self::Element { &mut self[0][0] }