Repository navigation
Open
Labels
C-tracking-issueCategory: An issue tracking the progress of sth. like the implementation of an RFCCategory: An issue tracking the progress of sth. like the implementation of an RFCS-tracking-unimplementedStatus: The feature has not been implemented.Status: The feature has not been implemented.T-libsRelevant to the library team, which will review and decide on the PR/issue.Relevant to the library team, which will review and decide on the PR/issue.
Description
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
- API change proposal (ACP): #496
- Implementation:
- Implementation for
Box<[_]>,Rc<[_]>, andArc<[_]>: Addinto_arrayconversion destructors forBox,Rc, andArc. #134379 - Update feature gates and tracking issues in source: Stabilise
as_arrayin[_]and*const [_]; stabiliseas_mut_arrayin[_]and*mut [_]. #147540 - Support custom allocators: Make Box/Rc/Arc::into_array allocator-aware (and add doctest) #154925
- Reimplementation for using
Resultinstead ofOption: Fix doc typo in Vec::into_array and convert Arc/Box/Rc::into_arry to -> Result #156810 - Implementation for
Vec<_>: implementinto_arrayforVec<T>#156234
- Implementation for
- Final comment period (FCP)
- Stabilisation
Unresolved Questions
const-compatibility?:OptionorResult?Result(assumed.)- Implementations for
MutexandRwLock? Vec::into_boxed_array?String::into_boxed_bytes_array?
Reacted by José Luis Cruz
Metadata
Metadata
Assignees
Labels
C-tracking-issueCategory: An issue tracking the progress of sth. like the implementation of an RFCCategory: An issue tracking the progress of sth. like the implementation of an RFCS-tracking-unimplementedStatus: The feature has not been implemented.Status: The feature has not been implemented.T-libsRelevant to the library team, which will review and decide on the PR/issue.Relevant to the library team, which will review and decide on the PR/issue.
Activity
[-]Tracking Issue for `alloc_slice_as_array`.[/-][+]Tracking Issue for `alloc_slice_into_array`.[/+]Rollup merge of rust-lang#154925 - zachs18:heap-into-array-with-alloc…
Rollup merge of rust-lang#154925 - zachs18:heap-into-array-with-alloc…
Unrolled build for #154925
Rollup merge of rust-lang#156810 - Teufelchen1:fix_doc_typo, r=SimonS…
Unrolled build for #156810
Rollup merge of rust-lang#158418 - viliml:vec_into_array_unwrap_unche…
Rollup merge of rust-lang#158418 - viliml:vec_into_array_unwrap_unche…
Unrolled build for #158418
Rollup merge of #158418 - viliml:vec_into_array_unwrap_unchecked, r=D…
Rollup merge of #158418 - viliml:vec_into_array_unwrap_unchecked, r=D…
Rollup merge of #158418 - viliml:vec_into_array_unwrap_unchecked, r=D…