Skip to main content

Connect

Trait Connect 

Source
pub trait Connect: Sync + Send {
    // Required method
    fn connect(
        &self,
        pg_config: &PgConfig,
    ) -> Pin<Box<dyn Future<Output = Result<(PgClient, JoinHandle<()>), Error>> + Send + '_>>;
}
Expand description

Describes a mechanism for establishing a connection to a PostgreSQL server via tokio_postgres.

Required Methods§

Source

fn connect( &self, pg_config: &PgConfig, ) -> Pin<Box<dyn Future<Output = Result<(PgClient, JoinHandle<()>), Error>> + Send + '_>>

Establishes a new tokio_postgres connection, returning the associated Client and a JoinHandle to a tokio task for processing the connection.

Dyn Compatibility§

This trait is dyn compatible.

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

Implementors§

Source§

impl<T> Connect for ConfigConnectImpl<T>
where T: MakeTlsConnect<Socket> + Clone + Sync + Send + 'static, T::Stream: Sync + Send, T::TlsConnect: Sync + Send, <T::TlsConnect as TlsConnect<Socket>>::Future: Send,

Available on non-WebAssembly only.