Feature gate: #![feature(ptr_cast_slice)]
This is a tracking issue for rust-lang/libs-team#693
This feature adds method calls on raw pointers that call into the respective ptr::slice_from_raw_parts{_mut} method for the types *const T, *mut T and NonNull<T> to make using raw pointers more ergonomic in Rust by supporting postfix method chain syntax while creating slices.
Public API
// core::ptr::const_ptr
impl<T> *const T {
pub const fn cast_slice(self, len: usize) -> *const [T];
}
// core::ptr::mut_ptr
impl<T> *mut T {
pub const fn cast_slice(self, len: usize) -> *mut [T];
}
// core::ptr::non_null
impl<T> NonNull<T> {
pub const fn cast_slice(self, len: usize) -> NonNull<[T]>;
}
Steps / History
(Remember to update the S-tracking-* label when checking boxes.)
Unresolved Questions
Feature gate:
#![feature(ptr_cast_slice)]This is a tracking issue for rust-lang/libs-team#693
This feature adds method calls on raw pointers that call into the respective
ptr::slice_from_raw_parts{_mut}method for the types*const T,*mut TandNonNull<T>to make using raw pointers more ergonomic in Rust by supporting postfix method chain syntax while creating slices.Public API
Steps / History
(Remember to update the
S-tracking-*label when checking boxes.)cast_slicefor raw pointer types #149110Unresolved Questions
Footnotes
https://std-dev-guide.rust-lang.org/feature-lifecycle/stabilization.html ↩