Skip to main content

HttpConnectionPool

Trait HttpConnectionPool 

Source
pub trait HttpConnectionPool {
    type Identity: Identity;
    type Certificate: Certificate;
    type ConnectionDispather: HttpConnectionDispatcher;
    type ConnectionCache;

    // Required methods
    fn new(max_idle_connections: u32, keep_alive_duration: Duration) -> Self;
    fn connections(&self) -> &Self::ConnectionCache;
    fn connection_count(&self) -> u32;
    fn create_connection<D>(
        &mut self,
        config: &ConnectionConfig<'_, Self::Identity, Self::Certificate>,
        dns_resolver: &D,
    ) -> impl Future<Output = Result<&mut Self::ConnectionDispather>>
       where D: DnsResolver;
}
Expand description

Trait that represents the HTTP connection pool.

Required Associated Types§

Source

type Identity: Identity

The identity type.

Source

type Certificate: Certificate

The certificate type.

Source

type ConnectionDispather: HttpConnectionDispatcher

The connection dispatcher type.

Source

type ConnectionCache

The connection cache type.

Required Methods§

Source

fn new(max_idle_connections: u32, keep_alive_duration: Duration) -> Self

Allow create a new connection pool.

§Returns
  • HttpConnectionPool - The new connection pool.
Source

fn connections(&self) -> &Self::ConnectionCache

Allow get connections.

§Returns
  • &Self::ConnectionCache - The connections.
Source

fn connection_count(&self) -> u32

Returns the number of connections.

§Returns
  • u32 - The number of connections.
Source

fn create_connection<D>( &mut self, config: &ConnectionConfig<'_, Self::Identity, Self::Certificate>, dns_resolver: &D, ) -> impl Future<Output = Result<&mut Self::ConnectionDispather>>
where D: DnsResolver,

Allow create a new connection.

§Arguments
  • config - The connection configuration.
  • dns_resolver - The DNS resolver to use.
§Returns
  • Result<&mut Self::ConnectionDispather> - The connection or error.

Dyn Compatibility§

This trait is not dyn compatible.

In older versions of Rust, dyn compatibility was called "object safety".

Implementors§