Function hyper::ffi::hyper_body_set_data_func
source · [−]#[no_mangle]
pub extern "C" fn hyper_body_set_data_func(
body: *mut hyper_body,
func: extern "C" fn(_: *mut c_void, _: *mut hyper_context<'_>, _: *mut *mut hyper_buf) -> c_int
)Expand description
Set the data callback for this body.
The callback is called each time hyper needs to send more data for the
body. It is passed the value from hyper_body_set_userdata.
If there is data available, the hyper_buf ** argument should be set
to a hyper_buf * containing the data, and HYPER_POLL_READY should
be returned.
Returning HYPER_POLL_READY while the hyper_buf ** argument points
to NULL will indicate the body has completed all data.
If there is more data to send, but it isn’t yet available, a
hyper_waker should be saved from the hyper_context * argument, and
HYPER_POLL_PENDING should be returned. You must wake the saved waker
to signal the task when data is available.
If some error has occurred, you can return HYPER_POLL_ERROR to abort
the body.