Function hyper::ffi::hyper_buf_copy

source ·
#[no_mangle]
pub extern "C" fn hyper_buf_copy(
    buf: *const u8,
    len: size_t
) -> *mut hyper_buf
Available on crate feature ffi and hyper_unstable_ffi only.
Expand description

Create a new hyper_buf * by copying the provided bytes.

This makes an owned copy of the bytes, so the buf argument can be freed (with hyper_buf_free) or changed afterwards.

To avoid a memory leak, the copy must eventually be consumed by hyper_buf_free.

This returns NULL if allocating a new buffer fails.