pub struct ConnPool { /* private fields */ }
Expand description
SQLite connection pool.
This is a somewhat specialized connection pool that only allows a single writer but multiple readers.
Implementations§
source§impl ConnPool
impl ConnPool
sourcepub fn reader(&self) -> Result<PooledConnection<SqliteConnectionManager>, Error>
pub fn reader(&self) -> Result<PooledConnection<SqliteConnectionManager>, Error>
Acquire a read-only connection.
sourcepub fn writer(&self) -> WrConn
pub fn writer(&self) -> WrConn
Acquire the read/write connection.
If the writer is already taken, then block and wait for it to become available.
sourcepub fn try_writer(&self) -> Option<WrConn>
pub fn try_writer(&self) -> Option<WrConn>
Attempt to acquire the writer connection.
Returns Some(conn)
if the writer connection was available at the time
of the request. Returns None
if the writer has already been taken.
sourcepub fn ro_run_result<F, T, E>(&self, f: F) -> Result<WaitCtx<T, (), E>, Error>
pub fn ro_run_result<F, T, E>(&self, f: F) -> Result<WaitCtx<T, (), E>, Error>
Run a closure with read-only connection, returning a channel end-point for retreiving result.
sourcepub fn rw_run_result<F, T, E>(&self, f: F) -> WaitCtx<T, (), E>
pub fn rw_run_result<F, T, E>(&self, f: F) -> WaitCtx<T, (), E>
Run a closure with read/write connection, returning a channel end-point for retreiving result.
Auto Trait Implementations§
impl !RefUnwindSafe for ConnPool
impl Send for ConnPool
impl Sync for ConnPool
impl Unpin for ConnPool
impl !UnwindSafe for ConnPool
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