tokio-curl 0.1.8

An implementation of an asynchronous HTTP client using futures backed by libcurl.

Struct tokio_curl::Session [] [src]

pub struct Session { /* fields omitted */ }

A shared cache for HTTP requests to pool data such as TCP connections between.

All HTTP requests in this crate are performed through a Session type. A Session can be cloned to acquire multiple references to the same session.

Sessions are created through the Session::new method, which returns a future that will resolve to a session once it's been initialized.

Methods

impl Session
[src]

Creates a new HTTP session object which will be bound to the given event loop.

When using libcurl it will provide us with file descriptors to listen for events on, so we'll need raw access to an actual event loop in order to hook up all the pieces together. The event loop will also be the I/O home for this HTTP session. All HTTP I/O will occur on the event loop thread.

This function returns a future which will resolve to a Session once it's been initialized.

Execute and HTTP request asynchronously, returning a future representing the request's completion.

This method will consume the provided Easy handle, which should be configured appropriately to send off an HTTP request. The returned future will resolve back to the handle once the request is performed, along with any error that happened along the way.

The Item of the returned future is (Easy, Option<Error>) so you can always get the Easy handle back, and the Error part of the future is io::Error which represents errors communicating with the event loop or otherwise fatal errors for the Easy provided.

Note that if the Perform future is dropped it will cancel the outstanding HTTP request, cleaning up all resources associated with it.

Trait Implementations

impl Clone for Session
[src]

Returns a copy of the value. Read more

Performs copy-assignment from source. Read more