pub struct Pool { /* private fields */ }
Expand description
A simple Pool of sqlite connections.
A Pool has the same API as an individual Client
.
Implementations§
Source§impl Pool
impl Pool
Sourcepub async fn conn<F, T>(&self, func: F) -> Result<T, Error>
pub async fn conn<F, T>(&self, func: F) -> Result<T, Error>
Invokes the provided function with a rusqlite::Connection
.
Sourcepub async fn conn_with_err<F, T, E: From<Error> + From<Error> + Send + 'static>(
&self,
func: F,
) -> Result<T, E>
pub async fn conn_with_err<F, T, E: From<Error> + From<Error> + Send + 'static>( &self, func: F, ) -> Result<T, E>
Invokes the provided function with a rusqlite::Connection
.
Sourcepub async fn conn_mut<F, T>(&self, func: F) -> Result<T, Error>
pub async fn conn_mut<F, T>(&self, func: F) -> Result<T, Error>
Invokes the provided function with a mutable rusqlite::Connection
.
Sourcepub async fn conn_mut_with_err<F, T, E: From<Error> + From<Error> + Send + 'static>(
&self,
func: F,
) -> Result<T, E>
pub async fn conn_mut_with_err<F, T, E: From<Error> + From<Error> + Send + 'static>( &self, func: F, ) -> Result<T, E>
Invokes the provided function with a mutable rusqlite::Connection
.
Sourcepub async fn transaction_write<F, T, E: From<Error> + From<Error> + Send + 'static>(
&self,
func: F,
) -> Result<T, E>
pub async fn transaction_write<F, T, E: From<Error> + From<Error> + Send + 'static>( &self, func: F, ) -> Result<T, E>
Invokes the provided function wrapping a new rusqlite::Transaction
that is committed automatically.
Sourcepub async fn transaction_read<F, T, E: From<Error> + From<Error> + Send + 'static>(
&self,
func: F,
) -> Result<T, E>
pub async fn transaction_read<F, T, E: From<Error> + From<Error> + Send + 'static>( &self, func: F, ) -> Result<T, E>
Invokes the provided function wrapping a new rusqlite::Transaction
that is committed automatically.
Sourcepub async fn close(&self) -> Result<(), Error>
pub async fn close(&self) -> Result<(), Error>
Closes the underlying sqlite connections.
After this method returns, all calls to self::conn()
or
self::conn_mut()
will return an Error::Closed
error.
Sourcepub fn conn_blocking<F, T>(&self, func: F) -> Result<T, Error>
pub fn conn_blocking<F, T>(&self, func: F) -> Result<T, Error>
Invokes the provided function with a rusqlite::Connection
, blocking
the current thread.
Sourcepub fn conn_mut_blocking<F, T>(&self, func: F) -> Result<T, Error>
pub fn conn_mut_blocking<F, T>(&self, func: F) -> Result<T, Error>
Invokes the provided function with a mutable rusqlite::Connection
,
blocking the current thread.
Sourcepub fn close_blocking(&self) -> Result<(), Error>
pub fn close_blocking(&self) -> Result<(), Error>
Closes the underlying sqlite connections, blocking the current thread.
After this method returns, all calls to self::conn_blocking()
or
self::conn_mut_blocking()
will return an Error::Closed
error.