Struct jsonrpc_client_http::HttpTransport [] [src]

pub struct HttpTransport { /* fields omitted */ }

The main struct of the HTTP transport implementation for jsonrpc_client_core.

Acts as a handle to a stream running on the Tokio Core event loop thread. The handle allows sending Hyper Requests to the event loop and the stream running there will then send it to the destination and wait for the response.

This is just a handle without any destination (URI), and it does not implement Transport. To get a handle implementing Transport to use with an RPC client you call the handle method with a URI.

Methods

impl HttpTransport
[src]

[src]

Creates a HttpTransport backed by its own Tokio Core running in a separate thread that is exclusive to this transport instance. To make the transport run on an existing event loop, use the shared method instead.

The transport returned from this method uses the hyper_tls::HttpsConnector connector, and supports both http and https connections.

[src]

Creates a HttpTransport backed by the Tokio Handle given to it. Use the new method to make it create its own internal event loop.

The transport returned from this method uses the hyper_tls::HttpsConnector connector, and supports both http and https connections.

[src]

Creates a HttpTransport backed by its own Tokio Core, just like new, but with a custom Hyper Client.

Example


HttpTransport::with_client(|handle: &Handle| {
    Ok(hyper::Client::configure()
        .keep_alive(false)
        .build(handle)
    ) as Result<_, io::Error>
}).unwrap();

[src]

Creates a HttpTransport backed by the Tokio Handle given to it, just like shared, but with a custom Hyper Client. See with_client for an example.

[src]

Returns a handle to this HttpTransport valid for a given URI.

Used to create instances implementing jsonrpc_client_core::Transport for use with RPC clients.

Trait Implementations

impl Debug for HttpTransport
[src]

[src]

Formats the value using the given formatter. Read more

impl Clone for HttpTransport
[src]

[src]

Returns a copy of the value. Read more

1.0.0
[src]

Performs copy-assignment from source. Read more

Auto Trait Implementations

impl Send for HttpTransport

impl Sync for HttpTransport