pub struct DbHandles { /* private fields */ }Expand description
Pair of writer and reader database handles.
Implementations§
Source§impl DbHandles
impl DbHandles
Sourcepub fn single(db: DatabaseConnection) -> Self
pub fn single(db: DatabaseConnection) -> Self
Creates writer/reader handles backed by the same connection.
Sourcepub fn sqlite_read_write_split(&self) -> bool
pub fn sqlite_read_write_split(&self) -> bool
Returns whether SQLite writer and reader use separate pools.
Sourcepub async fn close(self) -> Result<()>
pub async fn close(self) -> Result<()>
Closes the underlying database pools.
Split SQLite handles own two independent pools, so both reader and writer must be closed. Single-handle configurations clone the same pool into both fields and only close the writer once.
Both pools are always asked to close, even when the reader close fails: an early return
would leak the writer pool (SQLite WAL/file handles) with no way to retry, because close
consumes the handles. The reader error, being the first failure, is the one returned.
Trait Implementations§
Auto Trait Implementations§
impl Freeze for DbHandles
impl !RefUnwindSafe for DbHandles
impl Send for DbHandles
impl Sync for DbHandles
impl Unpin for DbHandles
impl UnsafeUnpin for DbHandles
impl !UnwindSafe for DbHandles
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
Source§impl<T> CloneToUninit for Twhere
T: Clone,
impl<T> CloneToUninit for Twhere
T: Clone,
§impl<T> Instrument for T
impl<T> Instrument for T
§fn instrument(self, span: Span) -> Instrumented<Self>
fn instrument(self, span: Span) -> Instrumented<Self>
§fn in_current_span(self) -> Instrumented<Self>
fn in_current_span(self) -> Instrumented<Self>
Source§impl<T> IntoEither for T
impl<T> IntoEither for T
Source§fn into_either(self, into_left: bool) -> Either<Self, Self>
fn into_either(self, into_left: bool) -> Either<Self, Self>
Converts
self into a Left variant of Either<Self, Self>
if into_left is true.
Converts self into a Right variant of Either<Self, Self>
otherwise. Read moreSource§fn into_either_with<F>(self, into_left: F) -> Either<Self, Self>
fn into_either_with<F>(self, into_left: F) -> Either<Self, Self>
Converts
self into a Left variant of Either<Self, Self>
if into_left(&self) returns true.
Converts self into a Right variant of Either<Self, Self>
otherwise. Read more