pub struct WriteTransactionGuard { /* private fields */ }Expand description
RAII token proving “I hold the write-transaction slot for this store.” See the module doc for the full rationale.
Implementations§
Source§impl WriteTransactionGuard
impl WriteTransactionGuard
Sourcepub fn acquire(db_context: &DbContext, site: &'static str) -> Result<Self>
pub fn acquire(db_context: &DbContext, site: &'static str) -> Result<Self>
Claim the write-transaction slot for db_context’s store. site names
the call site, used only in the panic/error message.
§Panics
In debug builds, panics immediately if this store’s slot is already held — some other write transaction is already open on it. Turns the silent-data-loss failure mode this guards against into a loud one, at the exact call site that introduced the second writer (or, for a same-thread re-entry, the call site that never released its own previous guard — see the module doc).
§Errors
In release builds, returns an error instead of panicking — a shipped build should degrade to a reported failure, not abort the process.
Trait Implementations§
Source§impl Debug for WriteTransactionGuard
impl Debug for WriteTransactionGuard
Source§impl Drop for WriteTransactionGuard
impl Drop for WriteTransactionGuard
Auto Trait Implementations§
impl Freeze for WriteTransactionGuard
impl RefUnwindSafe for WriteTransactionGuard
impl Send for WriteTransactionGuard
impl Sync for WriteTransactionGuard
impl Unpin for WriteTransactionGuard
impl UnsafeUnpin for WriteTransactionGuard
impl UnwindSafe for WriteTransactionGuard
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