[][src]Trait solicit::http::client::HttpConnect

pub trait HttpConnect {
    type Stream: TransportStream;
    type Err: HttpConnectError + 'static;
    fn connect(self) -> Result<ClientStream<Self::Stream>, Self::Err>;
}

A trait that can be implemented by structs that want to provide the functionality of establishing network connections for use by HTTP/2 connections.

The ClientStream instance returned from the connect method needs to contain the TransportStream that can be used by an HTTP/2 connection, along with the appropriate scheme (depending on how the connection was established), and the remote host name.

The transport stream needs to have already been initialized by writing the client preface. The helper function write_preface can be used for this purpose.

Associated Types

type Stream: TransportStream

The type of the underlying transport stream that the HttpConnections produced by this HttpConnect implementation will be based on.

type Err: HttpConnectError + 'static

The type of the error that can be produced by trying to establish the connection (i.e. calling the connect method).

Loading content...

Required methods

fn connect(self) -> Result<ClientStream<Self::Stream>, Self::Err>

Establishes a network connection that can be used by HTTP/2 connections.

Loading content...

Implementors

impl<'a> HttpConnect for CleartextConnector<'a>[src]

type Stream = TcpStream

type Err = CleartextConnectError

fn connect(self) -> Result<ClientStream<TcpStream>, CleartextConnectError>[src]

Establishes a cleartext TCP connection based on the host and port. If it is not possible, returns an HttpError.

impl<'a, 'ctx> HttpConnect for TlsConnector<'a, 'ctx>[src]

Loading content...