Struct mio_httpc::Httpc

source ·
pub struct Httpc { /* private fields */ }

Implementations

Httpc will create connections with mio token in range [con_offset..con_offset+0xFFFF]

Reconfigure httpc.

Number of currently open connections (in active and idle keep-alive state)

Reuse a response buffer for subsequent calls.

Prematurely finish call.

Call periodically to check for call timeouts and DNS retries. Returns list of calls that have timed out. You must execute call_close yourself (or SimpleCall::abort) and timeout will return them every time until you do. (every 100ms for example)

Same as timeout except that timed out calls get appended. This way you can reuse old allocations (if you truncated to 0).

Get CallRef for ev if token in configured range for Httpc. Compare CallRef with external Call to find out which call this event belongs to if any.

This call is mandatory as it sets up internal data structures for when something is signalled! Even if you know which call is being signalled, you must call event to let mio_httpc know what state socket is in.

For streaming API first you must call call_send until you get a SendState::Receiving after that call is in receive state and you must call call_recv.

If request has body it will be either taken from buf, from Request provided to CallBuilder or will return SendState::WaitReqBody.

buf slice is assumed to have taken previous SendState::SentBody(usize) into account and starts from part of buffer that has not been sent yet.

If no buf provided, response body (if any) is stored in an internal buffer. If buf provided after some body has been received, it will be copied to it.

Buf will be expanded if required. Bytes are always appended. If you want to receive response entirely in buf, you should reserve capacity for entire body before calling call_recv.

If body is only stored in internal buffer it will be limited to CallBuilder::max_response.

Auto Trait Implementations

Blanket Implementations

Gets the TypeId of self. Read more
Immutably borrows from an owned value. Read more
Mutably borrows from an owned value. Read more

Returns the argument unchanged.

Calls U::from(self).

That is, this conversion is whatever the implementation of From<T> for U chooses to do.

The type returned in the event of a conversion error.
Performs the conversion.
The type returned in the event of a conversion error.
Performs the conversion.