Skip to main content

adopt_bytes

Function adopt_bytes 

Source
pub unsafe fn adopt_bytes(ptr: *mut u8, len: usize) -> Option<Vec<u8>>
Expand description

Adopt a run from alloc (or one this runtime returned) as an owned vector. Null with a length of 0 is the empty run; null with any other length yields None.

ยงSafety

ptr must be null or a run of exactly len bytes from alloc or bytes_into_raw that nothing else releases or uses afterward.