File tree Expand file tree Collapse file tree 1 file changed +22
-0
lines changed
Expand file tree Collapse file tree 1 file changed +22
-0
lines changed Original file line number Diff line number Diff line change @@ -4906,6 +4906,28 @@ impl<T> [T] {
49064906
49074907 if start <= self . len ( ) && end <= self . len ( ) { Some ( start..end) } else { None }
49084908 }
4909+
4910+ /// Returns the same slice `&[T]`.
4911+ ///
4912+ /// This method is redundant when used directly on `&[T]`, but
4913+ /// it helps dereferencing other "container" types to slices,
4914+ /// for example `Box<[T]>` or `Arc<[T]>`.
4915+ #[ inline]
4916+ #[ unstable( feature = "str_as_str" , issue = "130366" ) ]
4917+ pub const fn as_slice ( & self ) -> & [ T ] {
4918+ self
4919+ }
4920+
4921+ /// Returns the same slice `&mut [T]`.
4922+ ///
4923+ /// This method is redundant when used directly on `&mut [T]`, but
4924+ /// it helps dereferencing other "container" types to slices,
4925+ /// for example `Box<[T]>` or `Arc<[T]>`.
4926+ #[ inline]
4927+ #[ unstable( feature = "str_as_str" , issue = "130366" ) ]
4928+ pub const fn as_mut_slice ( & mut self ) -> & mut [ T ] {
4929+ self
4930+ }
49094931}
49104932
49114933impl < T > [ MaybeUninit < T > ] {
You can’t perform that action at this time.
0 commit comments