Open
Description
Feature gate: #![feature(array_ptr_get)]
This is a tracking issue for as_(mut_)ptr
and as_(mut_)slice
methods on raw array pointers, i.e. *(const/mut) [T; N]
.
See also:
- Similar methods for raw slices: Tracking Issue for raw slice getters (slice_ptr_get) #74265
Public API
impl<T, const N: usize> *mut [T; N] {
pub fn as_mut_ptr(self) -> *mut T {}
pub fn as_mut_slice(self) -> *mut [T] {}
}
impl<T, const N: usize> *const [T; N] {
pub const fn as_ptr(self) -> *const T {}
pub const fn as_slice(self) -> *const [T] {}
}
Steps / History
- ACP: as_(mut_)ptr and as_(mut_)slice methods on raw array pointers libs-team#321
- Implementation: Add as_(mut_)ptr and as_(mut_)slice to raw array pointers #119411
- Final comment period (FCP)1
- Stabilization PR
Unresolved Questions
- If arbitrary_self_types (Arbitrary self types v2 rfcs#3519) is accepted, these methods may be changed to have a
*(const/mut) Self
receiver. Also, if a deref-like coercion mechanism is added (specifically,*[T; N]
->*[T]
, similar to the non-raw counterparts), these methods might become redundant.