Feature gate: #![feature(alloc_slice_into_array)]
Branched from: #133508
This is a tracking issue for adding conversion functions going from allocated slices to allocated arrays.
Public API
// 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>;
}
// alloc::vec
impl<T> Vec<T> {
pub fn into_array<const N: usize>(self) -> Result<Box<[T; N]>, Self>;
}
Steps / History
Unresolved Questions
const-compatibility?
Option or Result? : Result (assumed.)
- Implementations for
Mutex and RwLock?
Vec::into_boxed_array?
String::into_boxed_bytes_array?
Feature gate:
#![feature(alloc_slice_into_array)]Branched from: #133508
This is a tracking issue for adding conversion functions going from allocated slices to allocated arrays.
Public API
Steps / History
Box<[_]>,Rc<[_]>, andArc<[_]>: Addinto_arrayconversion destructors forBox,Rc, andArc. #134379as_arrayin[_]and*const [_]; stabiliseas_mut_arrayin[_]and*mut [_]. #147540Resultinstead ofOption: Fix doc typo in Vec::into_array and convert Arc/Box/Rc::into_arry to -> Result #156810Vec<_>: implementinto_arrayforVec<T>#156234Unresolved Questions
const-compatibility?:OptionorResult?Result(assumed.)MutexandRwLock?Vec::into_boxed_array?String::into_boxed_bytes_array?