Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
11 changes: 11 additions & 0 deletions src/arrayvec.rs
Original file line number Diff line number Diff line change
Expand Up @@ -1257,6 +1257,17 @@ impl<A> ArrayVec<A> {
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`
Expand Down
23 changes: 23 additions & 0 deletions src/slicevec.rs
Original file line number Diff line number Diff line change
Expand Up @@ -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.
Expand Down