pub struct PgAdvisoryLock { /* private fields */ }Expand description
会话级 advisory lock 的 RAII guard。
锁绑定在 guard 持有的那条连接上:显式 unlock 会执行
pg_advisory_unlock(共享锁为 pg_advisory_unlock_shared)并把连接归还池;
未解锁即丢弃时无法在同步 Drop 中执行异步解锁,因此 detach 连接使其关闭,
由服务端回收该会话持有的全部会话级锁。
Implementations§
Trait Implementations§
Source§impl Drop for PgAdvisoryLock
impl Drop for PgAdvisoryLock
Auto Trait Implementations§
impl !RefUnwindSafe for PgAdvisoryLock
impl !UnwindSafe for PgAdvisoryLock
impl Forget for PgAdvisoryLock
impl Freeze for PgAdvisoryLock
impl Move for PgAdvisoryLock
impl Send for PgAdvisoryLock
impl Sync for PgAdvisoryLock
impl Unpin for PgAdvisoryLock
impl UnsafeUnpin for PgAdvisoryLock
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