/// Create a `&mut UninitSlice` from a pointer and a length.
///
/// # Safety
///
/// The caller must ensure that `ptr` references a valid memory region owned
/// by the caller representing a byte slice for the duration of `'a`.
///
#[inline]
pub unsafe fn from_raw_parts_mut<'a>(ptr: *mut u8, len: usize) -> &'a mut UninitSlice {
let maybe_init: &mut [MaybeUninit<u8>] =
core::slice::from_raw_parts_mut(ptr as *mut _, len);
Self::from_slice(maybe_init)
}
这里*mut _这是什么含义
1
共 2 条评论, 1 页
评论区
写评论The Book里关于raw pointer的部分: Dereferencing a Raw Pointer
https://doc.rust-lang.org/reference/types/pointer.html#raw-pointers-const-and-mut