Use `first_ptr` and `first_ptr_mut` in `as_ptr` and `as_mut_ptr`
@@ -280,15 +280,13 @@ impl<T, const N: usize> StaticVec<T, N> {
/// Returns a constant pointer to the first element of the StaticVec's internal array.
#[inline(always)]
pub const fn as_ptr(&self) -> *const T {
- // Written like this so it can be a `const fn`.
- &self.data as *const MaybeUninit<[T; N]> as *const T
+ Self::first_ptr(&self.data)
}
/// Returns a mutable pointer to the first element of the StaticVec's internal array.
#[inline(always)]
pub const fn as_mut_ptr(&mut self) -> *mut T {
- // Written like this so it can be a `const fn`.
- &mut self.data as *mut MaybeUninit<[T; N]> as *mut T
+ Self::first_ptr_mut(&mut self.data)
}
/// Returns a constant reference to a slice of the StaticVec's inhabited area.
