RalfJung · GitHub

View all comments

This is a tracking issue for indexing methods on raw slices: get_unchecked(_mut) and as_(mut_/non_null_)ptr on raw slices (mutable and const raw pointers and NonNull).

The feature gate for the issue is #![feature(slice_ptr_get)].

Public API

impl<T> *mut [T] {
    pub const fn as_mut_ptr(self) -> *mut T {}
    pub unsafe fn get_unchecked_mut<I>(self, index: I) -> *mut I::Output where I: SliceIndex<[T]>;
}
impl<T> *const [T] {
    pub const fn as_ptr(self) -> *const T {}
    pub unsafe fn get_unchecked<I>(self, index: I) -> *const I::Output where I: SliceIndex<[T]>;
}
impl<T> NonNull<[T]> {
    pub const fn as_non_null_ptr(self) -> NonNull<T> {}
    pub const fn as_mut_ptr(self) -> *mut T {}
    pub unsafe fn get_unchecked_mut<I>(self, index: I) -> NonNull<I::Output> where I: SliceIndex<[T]>;
}

History / Steps

Open questions

Read the original on github.com ↗