ConnectionSource

Trait ConnectionSource 

Source
pub trait ConnectionSource {
    type Builder: ConnectorBuilder;

    // Required method
    fn get_connector(
        &self,
        endpoint: &EndpointDescription,
    ) -> Result<Self::Builder, Error>;
}
Expand description

Trait for getting a connection builder for a given endpoint. This is not the neatest interface, but it makes it possible to use a different connection source in the session builder.

Essentially, ConnectionSource takes an endpoint, and returns a connector builder, which is directly converted into a connector, which is then used to create a transport.

In practice:

  • A ConnectionSource uses an EndpointDescription to get a ConnectorBuilder.
  • A ConnectorBuilder is directly converted into a Connector. This trait exists so that methods that connect to an endpoint can take a type that implements ConnectorBuilder, for example an endpoint description.
  • A Connector is used to create a transport, which is then used to connect to the server.

Required Associated Types§

Source

type Builder: ConnectorBuilder

The type of connector builder returned by this connection source.

Required Methods§

Source

fn get_connector( &self, endpoint: &EndpointDescription, ) -> Result<Self::Builder, Error>

Get a connector builder for the given endpoint description.

Implementors§