From dd28498819adf11809da07b79d27bf3b2190dc31 Mon Sep 17 00:00:00 2001 From: Jean-Pierre De Jesus DIAZ Date: Mon, 27 Feb 2023 20:57:49 +0100 Subject: [PATCH] Make Vec::as_mut_slice public Signed-off-by: Jean-Pierre De Jesus DIAZ --- src/vec.rs | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/src/vec.rs b/src/vec.rs index a77ba5248a..ace8179655 100644 --- a/src/vec.rs +++ b/src/vec.rs @@ -161,7 +161,7 @@ impl Vec { /// Extracts a mutable slice containing the entire vector. /// - /// Equivalent to `&s[..]`. + /// Equivalent to `&mut s[..]`. /// /// # Examples /// @@ -171,7 +171,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) }