pub struct LockerGuard { /* private fields */ }Expand description
RAII guard over a set of acquired locks. Drop releases every
acquired resource in reverse-acquire order, so the common
Global → Collection path releases Collection first then
Global.
Implementations§
Source§impl LockerGuard
impl LockerGuard
Sourcepub fn new(manager: Arc<LockManager>) -> LockerGuard
pub fn new(manager: Arc<LockManager>) -> LockerGuard
Start a new guard bound to the given manager. No locks are
acquired yet — callers chain acquire calls.
Sourcepub fn acquire(
&mut self,
resource: Resource,
mode: LockMode,
) -> Result<(), AcquireError>
pub fn acquire( &mut self, resource: Resource, mode: LockMode, ) -> Result<(), AcquireError>
Acquire a lock on resource with mode. Records the
acquisition so drop can reverse it. Rejects illegal upgrades
(already holding Exclusive, requesting Shared) with
IncompatibleEscalation so bugs in the dispatch layer don’t
silently downgrade.
Sourcepub fn held_count(&self) -> usize
pub fn held_count(&self) -> usize
Number of currently-held resources. Useful for lock-stats assertions in tests.
Trait Implementations§
Source§impl Drop for LockerGuard
impl Drop for LockerGuard
Auto Trait Implementations§
impl Freeze for LockerGuard
impl RefUnwindSafe for LockerGuard
impl Send for LockerGuard
impl Sync for LockerGuard
impl Unpin for LockerGuard
impl UnsafeUnpin for LockerGuard
impl UnwindSafe for LockerGuard
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 moreSource§impl<T> IntoRequest<T> for T
impl<T> IntoRequest<T> for T
Source§fn into_request(self) -> Request<T>
fn into_request(self) -> Request<T>
Wrap the input message
T in a tonic::Request