diff --git a/src/arrayvec.rs b/src/arrayvec.rs index c55796d..62b9054 100644 --- a/src/arrayvec.rs +++ b/src/arrayvec.rs @@ -1257,6 +1257,17 @@ impl ArrayVec { pub const fn as_inner(&self) -> &A { &self.data } + + /// Returns a mutable reference to the inner array of the `ArrayVec`. + /// + /// This returns the full array, even if the `ArrayVec` length is currently + /// less than that. + #[inline(always)] + #[must_use] + #[cfg(feature = "latest_stable_rust")] + pub const fn as_mut_inner(&mut self) -> &mut A { + &mut self.data + } } /// Splicing iterator for `ArrayVec` diff --git a/src/slicevec.rs b/src/slicevec.rs index bb6b744..063b96a 100644 --- a/src/slicevec.rs +++ b/src/slicevec.rs @@ -634,6 +634,29 @@ impl<'s, T> SliceVec<'s, T> { } } +impl<'s, T> SliceVec<'s, T> { + /// Returns the reference to the inner slice of the `SliceVec`. + /// + /// This returns the full array, even if the `SliceVec` length is currently + /// less than that. + #[inline(always)] + #[must_use] + pub const fn as_inner(&self) -> &[T] { + &*self.data + } + + /// Returns a mutable reference to the inner slice of the `SliceVec`. + /// + /// This returns the full array, even if the `SliceVec` length is currently + /// less than that. + #[inline(always)] + #[must_use] + #[cfg(feature = "latest_stable_rust")] + pub const fn as_mut_inner(&mut self) -> &mut [T] { + self.data + } +} + #[cfg(feature = "grab_spare_slice")] impl<'s, T> SliceVec<'s, T> { /// Obtain the shared slice of the array _after_ the active memory.