Function hyper::ffi::hyper_body_foreach[][src]

#[no_mangle]
pub extern "C" fn hyper_body_foreach(
    body: *mut hyper_body,
    func: extern "C" fn(_: *mut c_void, _: *const hyper_buf) -> c_int,
    userdata: *mut c_void
) -> *mut hyper_task
Expand description

Return a task that will poll the body and execute the callback with each body chunk that is received.

The hyper_buf pointer is only a borrowed reference, it cannot live outside the execution of the callback. You must make a copy to retain it.

The callback should return HYPER_ITER_CONTINUE to continue iterating chunks as they are received, or HYPER_ITER_BREAK to cancel.

This will consume the hyper_body *, you shouldn’t use it anymore or free it.