pub struct WriteTx { /* private fields */ }Expand description
The write transaction of the current task: a handle to the connection it runs on.
Cloning the Arc is cheap; the connection is behind a mutex, so statements of one task run
one at a time, in order. After the transaction ends a clone that is still alive runs
statements outside any transaction, unscoped on a pool connection (fail-closed) or under the
request scope’s own variables.
Implementations§
Source§impl WriteTx
impl WriteTx
Sourcepub async fn conn(&self) -> WriteTxConn<'_>
pub async fn conn(&self) -> WriteTxConn<'_>
Lock the transaction’s connection to run statements on it: query.execute(&mut *tx.conn().await).
Do not hold the guard across a call that runs repository methods or opens a savepoint: they lock the same connection and would wait for it.
Auto Trait Implementations§
impl !RefUnwindSafe for WriteTx
impl !UnwindSafe for WriteTx
impl Freeze for WriteTx
impl Send for WriteTx
impl Sync for WriteTx
impl Unpin for WriteTx
impl UnsafeUnpin for WriteTx
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
impl<ST, DT> CastableFrom<ST, Initialized, Initialized> for DT
impl<ST, DT> CastableFrom<ST, Uninit, Uninit> for DT
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