pub trait ManageConnection:
Sized
+ Send
+ Sync
+ 'static {
type Connection: Send + 'static;
type Error: Debug + Send + 'static;
// Required methods
fn connect(
&self,
) -> impl Future<Output = Result<Self::Connection, Self::Error>> + Send;
fn is_valid(
&self,
conn: &mut Self::Connection,
) -> impl Future<Output = Result<(), Self::Error>> + Send;
fn has_broken(&self, conn: &mut Self::Connection) -> bool;
}Expand description
A trait which provides connection-specific functionality.
Required Associated Types§
Sourcetype Connection: Send + 'static
type Connection: Send + 'static
The connection type this manager deals with.
Required Methods§
Sourcefn connect(
&self,
) -> impl Future<Output = Result<Self::Connection, Self::Error>> + Send
fn connect( &self, ) -> impl Future<Output = Result<Self::Connection, Self::Error>> + Send
Attempts to create a new connection.
Sourcefn is_valid(
&self,
conn: &mut Self::Connection,
) -> impl Future<Output = Result<(), Self::Error>> + Send
fn is_valid( &self, conn: &mut Self::Connection, ) -> impl Future<Output = Result<(), Self::Error>> + Send
Determines if the connection is still connected to the database.
Sourcefn has_broken(&self, conn: &mut Self::Connection) -> bool
fn has_broken(&self, conn: &mut Self::Connection) -> bool
Synchronously determine if the connection is no longer usable, if possible.
Dyn Compatibility§
This trait is not dyn compatible.
In older versions of Rust, dyn compatibility was called "object safety", so this trait is not object safe.