pub struct Pool { /* private fields */ }
Expand description
Asynchronous pool of MySql connections.
Actually Pool
is a shared reference, i.e. every clone will lead to the same instance
created with Pool::new
. Also Pool
satisfies Send
and Sync
, so you don’t have to wrap
it into an Arc
or Mutex
.
Note that you will probably want to await Pool::disconnect
before dropping the runtime, as
otherwise you may end up with a number of connections that are not cleanly terminated.
Implementations§
Source§impl Pool
impl Pool
Sourcepub async fn start_transaction(
&self,
options: TxOpts,
) -> Result<Transaction<'static>>
pub async fn start_transaction( &self, options: TxOpts, ) -> Result<Transaction<'static>>
Starts a new transaction.
Sourcepub fn disconnect(self) -> DisconnectPool ⓘ
pub fn disconnect(self) -> DisconnectPool ⓘ
Async function that disconnects this pool from the server and resolves to ()
.
Note: This Future won’t resolve until all active connections, taken from it,
are dropped or disonnected. Also all pending and new GetConn
’s will resolve to error.
Trait Implementations§
Source§impl<'a> ToConnection<'a, 'static> for &'a Pool
impl<'a> ToConnection<'a, 'static> for &'a Pool
Source§fn to_connection(self) -> ToConnectionResult<'a, 'static>
fn to_connection(self) -> ToConnectionResult<'a, 'static>
Converts self to a connection.
Source§impl ToConnection<'static, 'static> for Pool
impl ToConnection<'static, 'static> for Pool
Source§fn to_connection(self) -> ToConnectionResult<'static, 'static>
fn to_connection(self) -> ToConnectionResult<'static, 'static>
Converts self to a connection.
Auto Trait Implementations§
impl Freeze for Pool
impl !RefUnwindSafe for Pool
impl Send for Pool
impl Sync for Pool
impl Unpin for Pool
impl !UnwindSafe for Pool
Blanket Implementations§
Source§impl<T> BorrowMut<T> for Twhere
T: ?Sized,
impl<T> BorrowMut<T> for Twhere
T: ?Sized,
Source§fn borrow_mut(&mut self) -> &mut T
fn borrow_mut(&mut self) -> &mut T
Mutably borrows from an owned value. Read more