Skip to content

Commit 45517a5

Browse files
authored
Merge pull request #348 from Foundation-Devices/jeandudey/mut_slice
Make Vec::as_mut_slice public
2 parents f290006 + 29954b4 commit 45517a5

File tree

2 files changed

+3
-2
lines changed

2 files changed

+3
-2
lines changed

CHANGELOG.md

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -39,6 +39,7 @@ and this project adheres to [Semantic Versioning](http://semver.org/).
3939
- `defmt-impl` is now `defmt-03`
4040
- `ufmt-impl` is now `ufmt`
4141
- `cas` is removed, atomic polyfilling is now opt-in via the `portable-atomic` feature.
42+
- `Vec::as_mut_slice` is now a public method.
4243

4344
### Fixed
4445

src/vec.rs

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -158,7 +158,7 @@ impl<T, const N: usize> Vec<T, N> {
158158

159159
/// Extracts a mutable slice containing the entire vector.
160160
///
161-
/// Equivalent to `&s[..]`.
161+
/// Equivalent to `&mut s[..]`.
162162
///
163163
/// # Examples
164164
///
@@ -168,7 +168,7 @@ impl<T, const N: usize> Vec<T, N> {
168168
/// buffer[0] = 9;
169169
/// assert_eq!(buffer.as_slice(), &[9, 2, 3, 5, 8]);
170170
/// ```
171-
pub(crate) fn as_mut_slice(&mut self) -> &mut [T] {
171+
pub fn as_mut_slice(&mut self) -> &mut [T] {
172172
// NOTE(unsafe) avoid bound checks in the slicing operation
173173
// &mut buffer[..self.len]
174174
unsafe { slice::from_raw_parts_mut(self.buffer.as_mut_ptr() as *mut T, self.len) }

0 commit comments

Comments
 (0)