Function rfc2580::from_raw_parts [−][src]
pub fn from_raw_parts<T: ?Sized, M: MetaData<Pointee = T>>(
meta: M,
ptr: *mut u8
) -> *mut T
Joins a meta-data and data-pointer parts into a pointer to the appropriate type.
For the NonNull
equivalent, see from_non_null_parts
.
Examples
use rfc2580::{from_raw_parts, into_raw_parts}; let array = [1; 4]; let slice = &array[..]; let (meta, data) = into_raw_parts(slice as *const [i32] as *mut [i32]); let reconstituted = from_raw_parts(meta, data); assert_eq!(slice as *const [i32] as *mut [i32], reconstituted);