Feature gate: #![feature(slice_as_array)]
This is a tracking issue for adding conversion functions from slices to arrays.
Public APIimpl<T> [T] { pub const fn as_array<const N: usize>(&self) -> Option<&[T; N]>; pub const fn as_mut_array<const N: usize>(&mut self) -> Option<&mut [T; N]>; } impl<T> *const [T] { pub const fn as_array<const N: usize>(self) -> Option<*const [T; N]>; } impl<T> *mut [T] { pub const fn as_mut_array<const N: usize>(self) -> Option<*mut [T; N]>; } // alloc::boxed impl<T> Box<[T]> { pub fn into_array<const N: usize>(self) -> Result<Box<[T; N]>, Self>; } // alloc::rc impl<T> Rc<[T]> { pub fn into_array<const N: usize>(self) -> Result<Rc<[T; N]>, Self>; } // alloc::sync impl<T> Arc<[T]> { pub fn into_array<const N: usize>(self) -> Result<Arc<[T; N]>, Self>; }Steps / History
[T]
, *const [T]
, and *mut [T]
: Add as_array
and as_mut_array
conversion methods to slices. #133512<[T]>::as_array
: Fix docs for <[T]>::as_array
. #133743Box<[T]>
, Rc<[T]>
, and Arc<[T]>
: Add into_array
conversion destructors for Box
, Rc
, and Arc
. #134379Result
const
-compatible for the non-primitive types?Option
or Result
for the owning conversions?Mutex
and RwLock
?Vec::into_boxed_array
?str::as_bytes_array
and String::into_boxed_bytes_array
?joseluis, YYMMYB, cxw620, MathiasPius, TheNullicorn and 2 more
RetroSearch is an open source project built by @garambo | Open a GitHub Issue
Search and Browse the WWW like it's 1997 | Search results from DuckDuckGo
HTML:
3.2
| Encoding:
UTF-8
| Version:
0.7.4