Function hyper::ffi::hyper_io_set_read[][src]

#[no_mangle]
pub extern "C" fn hyper_io_set_read(
    io: *mut hyper_io,
    func: extern "C" fn(_: *mut c_void, _: *mut hyper_context<'_>, _: *mut u8, _: size_t) -> size_t
)
Expand description

Set the read function for this IO transport.

Data that is read from the transport should be put in the buf pointer, up to buf_len bytes. The number of bytes read should be the return value.

It is undefined behavior to try to access the bytes in the buf pointer, unless you have already written them yourself. It is also undefined behavior to return that more bytes have been written than actually set on the buf.

If there is no data currently available, a waker should be claimed from the ctx and registered with whatever polling mechanism is used to signal when data is available later on. The return value should be HYPER_IO_PENDING.

If there is an irrecoverable error reading data, then HYPER_IO_ERROR should be the return value.