pub enum MaybeOwnedTransaction<'a> {
Owned(Transaction),
Borrowed(&'a mut Transaction),
}Expand description
Either an owned or borrowed Transaction.
Variants§
Implementations§
Source§impl MaybeOwnedTransaction<'_>
impl MaybeOwnedTransaction<'_>
Sourcepub fn as_ref(&self) -> &Transaction
pub fn as_ref(&self) -> &Transaction
(Re-) Borrows the transaction
Sourcepub fn as_mut(&mut self) -> &mut Transaction
pub fn as_mut(&mut self) -> &mut Transaction
(Re-) Borrows the transaction
Sourcepub fn get_transaction(&mut self) -> &mut Transaction
👎Deprecated: Use deref instead
pub fn get_transaction(&mut self) -> &mut Transaction
Use deref instead
Get a reference to the guarded transaction
Sourcepub async fn commit_if_owned(self) -> Result<(), TransactionError>
pub async fn commit_if_owned(self) -> Result<(), TransactionError>
Commits the potentially owned transaction.
Sourcepub async fn rollback_if_owned(self) -> Result<(), Error>
pub async fn rollback_if_owned(self) -> Result<(), Error>
Rolls back the potentially owned transaction.
Sourcepub async fn commit(self) -> Result<(), TransactionError>
👎Deprecated: Use commit_if_owned instead
pub async fn commit(self) -> Result<(), TransactionError>
Use commit_if_owned instead
Consume the guard, committing the potentially owned transaction.
Methods from Deref<Target = Transaction>§
Sourcepub fn hooks(&mut self) -> SimpleHooksApi<'_>
pub fn hooks(&mut self) -> SimpleHooksApi<'_>
Accesses the simple API for adding hooks to the transaction
If you reach the API’s limits, consider Transaction::adv_hooks.
Sourcepub fn adv_hooks(&mut self) -> AdvancedHooksApi<'_>
pub fn adv_hooks(&mut self) -> AdvancedHooksApi<'_>
Accesses the advanced API for adding hooks to the transaction
If you’re new to transaction hooks, consider Transaction::hooks.
Trait Implementations§
Source§impl Deref for MaybeOwnedTransaction<'_>
impl Deref for MaybeOwnedTransaction<'_>
Auto Trait Implementations§
impl<'a> !RefUnwindSafe for MaybeOwnedTransaction<'a>
impl<'a> !Sync for MaybeOwnedTransaction<'a>
impl<'a> !UnwindSafe for MaybeOwnedTransaction<'a>
impl<'a> Freeze for MaybeOwnedTransaction<'a>
impl<'a> Send for MaybeOwnedTransaction<'a>
impl<'a> Unpin for MaybeOwnedTransaction<'a>
impl<'a> UnsafeUnpin for MaybeOwnedTransaction<'a>
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> Instrument for T
impl<T> Instrument for T
Source§fn instrument(self, span: Span) -> Instrumented<Self> ⓘ
fn instrument(self, span: Span) -> Instrumented<Self> ⓘ
Source§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