diff --git a/CHANGELOG.md b/CHANGELOG.md index b2dfeedd91..2ad88f8ba2 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -39,6 +39,7 @@ and this project adheres to [Semantic Versioning](http://semver.org/). - `defmt-impl` is now `defmt-03` - `ufmt-impl` is now `ufmt` - `cas` is removed, atomic polyfilling is now opt-in via the `portable-atomic` feature. +- `Vec::as_mut_slice` is now a public method. ### Fixed diff --git a/src/vec.rs b/src/vec.rs index f7e4ae380f..0dc25f1dd1 100644 --- a/src/vec.rs +++ b/src/vec.rs @@ -158,7 +158,7 @@ impl Vec { /// Extracts a mutable slice containing the entire vector. /// - /// Equivalent to `&s[..]`. + /// Equivalent to `&mut s[..]`. /// /// # Examples /// @@ -168,7 +168,7 @@ impl Vec { /// buffer[0] = 9; /// assert_eq!(buffer.as_slice(), &[9, 2, 3, 5, 8]); /// ``` - pub(crate) fn as_mut_slice(&mut self) -> &mut [T] { + pub fn as_mut_slice(&mut self) -> &mut [T] { // NOTE(unsafe) avoid bound checks in the slicing operation // &mut buffer[..self.len] unsafe { slice::from_raw_parts_mut(self.buffer.as_mut_ptr() as *mut T, self.len) }