Skip to main content

take_owned_bytes

Function take_owned_bytes 

Source
pub unsafe fn take_owned_bytes(buffer: AlefOwnedBuffer) -> Vec<u8> ⓘ
Expand description

Copy an owned buffer’s bytes into a Vec<u8> and release the original allocation through its own free callback.

Generated contract proxies use this to convert a component’s AlefOwnedBuffer results into owned Rust values without re-implementing buffer ownership handling in every generated snippet.

§Safety

buffer must be a valid AlefOwnedBuffer: ptr must be non-null and valid for len bytes whenever len > 0, and free (if present) must be safe to call with this buffer’s own context, ptr, len, and capacity.