Open
Description
Feature gate: #![feature(box_vec_non_null)]
This is a tracking issue for convenience methods for conversion between NonNull
and Vec
/Box
.
Public API
impl<T: ?Sized> Box<T> {
pub unsafe fn from_non_null(ptr: NonNull<T>) -> Self { .... }
}
impl<T: ?Sized, A: Allocator> Box<T, A> {
pub const unsafe fn from_non_null_in(raw: NonNull<T>, alloc: A) -> Self { .... }
pub fn into_non_null(b: Self) -> NonNull<T> { .... }
pub fn into_non_null_with_allocator(b: Self) -> (NonNull<T>, A) { .... }
}
impl<T> Vec<T> {
pub unsafe fn from_parts(ptr: NonNull<T>, length: usize, capacity: usize) -> Self { .... }
}
impl<T, A: Allocator> Vec<T, A> {
pub unsafe fn from_parts_in(ptr: NonNull<T>, length: usize, capacity: usize, alloc: A) -> Self { .... }
pub fn into_parts(self) -> (NonNull<T>, usize, usize) { .... }
pub fn into_parts_with_alloc(self) -> (NonNull<T>, usize, usize, A) { .... }
pub fn as_non_null(&mut self) -> NonNull<T> { .... }
}
Steps / History
- Implementation:
- ACP: Box/Vec/slice convenience NonNull methods libs-team#418
- Implementation PR: Add
NonNull
convenience methods toBox
andVec
#130061 - ACP 2:
Vec::as_non_null()
method libs-team#440 - Implementation PR 2: Add
Vec::as_non_null
#130624
- Final comment period (FCP)1
- Stabilization PR
Unresolved Questions
- None yet.