Skip to content

Commit

Permalink
Make as{_mut,}_slice on array::IntoIter public
Browse files Browse the repository at this point in the history
  • Loading branch information
est31 committed Nov 19, 2020
1 parent 675f114 commit de08df2
Showing 1 changed file with 4 additions and 2 deletions.
6 changes: 4 additions & 2 deletions library/core/src/array/iter.rs
Original file line number Diff line number Diff line change
Expand Up @@ -69,7 +69,8 @@ impl<T, const N: usize> IntoIter<T, N> {

/// Returns an immutable slice of all elements that have not been yielded
/// yet.
fn as_slice(&self) -> &[T] {
#[unstable(feature = "array_value_iter_slice", issue = "65798")]
pub fn as_slice(&self) -> &[T] {
// SAFETY: We know that all elements within `alive` are properly initialized.
unsafe {
let slice = self.data.get_unchecked(self.alive.clone());
Expand All @@ -78,7 +79,8 @@ impl<T, const N: usize> IntoIter<T, N> {
}

/// Returns a mutable slice of all elements that have not been yielded yet.
fn as_mut_slice(&mut self) -> &mut [T] {
#[unstable(feature = "array_value_iter_slice", issue = "65798")]
pub fn as_mut_slice(&mut self) -> &mut [T] {
// SAFETY: We know that all elements within `alive` are properly initialized.
unsafe {
let slice = self.data.get_unchecked_mut(self.alive.clone());
Expand Down

0 comments on commit de08df2

Please sign in to comment.