Trait l337::ManageConnection
source · pub trait ManageConnection: Send + Sync + 'static {
type Connection: Send + 'static;
type Error: Error + Send;
// Required methods
fn connect<'life0, 'async_trait>(
&'life0 self
) -> Pin<Box<dyn Future<Output = Result<Self::Connection, L337Error<Self::Error>>> + Send + 'async_trait>>
where Self: 'async_trait,
'life0: 'async_trait;
fn is_valid<'life0, 'life1, 'async_trait>(
&'life0 self,
conn: &'life1 mut Self::Connection
) -> Pin<Box<dyn Future<Output = Result<(), L337Error<Self::Error>>> + Send + 'async_trait>>
where Self: 'async_trait,
'life0: 'async_trait,
'life1: 'async_trait;
fn has_broken(&self, conn: &mut Self::Connection) -> bool;
fn timed_out(&self) -> L337Error<Self::Error>;
}
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<'life0, 'async_trait>(
&'life0 self
) -> Pin<Box<dyn Future<Output = Result<Self::Connection, L337Error<Self::Error>>> + Send + 'async_trait>>where
Self: 'async_trait,
'life0: 'async_trait,
fn connect<'life0, 'async_trait>( &'life0 self ) -> Pin<Box<dyn Future<Output = Result<Self::Connection, L337Error<Self::Error>>> + Send + 'async_trait>>where Self: 'async_trait, 'life0: 'async_trait,
Attempts to create a new connection.
Note that boxing is used here since impl Trait is not yet supported within trait definitions.
sourcefn is_valid<'life0, 'life1, 'async_trait>(
&'life0 self,
conn: &'life1 mut Self::Connection
) -> Pin<Box<dyn Future<Output = Result<(), L337Error<Self::Error>>> + Send + 'async_trait>>where
Self: 'async_trait,
'life0: 'async_trait,
'life1: 'async_trait,
fn is_valid<'life0, 'life1, 'async_trait>( &'life0 self, conn: &'life1 mut Self::Connection ) -> Pin<Box<dyn Future<Output = Result<(), L337Error<Self::Error>>> + Send + 'async_trait>>where Self: 'async_trait, 'life0: 'async_trait, 'life1: 'async_trait,
Determines if the connection is still connected to the database.
Note that boxing is used here since impl Trait is not yet supported within trait definitions.
sourcefn has_broken(&self, conn: &mut Self::Connection) -> bool
fn has_broken(&self, conn: &mut Self::Connection) -> bool
Quick check to determine if the connection has broken