pub struct TracedAsyncRwLock<T> { /* private fields */ }Expand description
A Tokio-based async rwlock whose acquisitions are recorded as tracing spans.
Each lock is identified by a static name, recorded as the lock field on the
utils.rwlock.read and utils.rwlock.write spans so wait time is attributable to a
specific lock.
Implementations§
Source§impl<T> TracedAsyncRwLock<T>
impl<T> TracedAsyncRwLock<T>
Sourcepub fn new(name: &'static str, value: T) -> Self
pub fn new(name: &'static str, value: T) -> Self
Create a new lock wrapping value, identified by name in traces.
Sourcepub async fn read(&self) -> AsyncRwLockReadGuard<'_, T>
pub async fn read(&self) -> AsyncRwLockReadGuard<'_, T>
Acquire a shared read guard, recording lock-wait time.
Sourcepub async fn write(&self) -> AsyncRwLockWriteGuard<'_, T>
pub async fn write(&self) -> AsyncRwLockWriteGuard<'_, T>
Acquire an exclusive write guard, recording lock-wait time.
Auto Trait Implementations§
impl<T> !Freeze for TracedAsyncRwLock<T>
impl<T> !RefUnwindSafe for TracedAsyncRwLock<T>
impl<T> Send for TracedAsyncRwLock<T>where
T: Send,
impl<T> Sync for TracedAsyncRwLock<T>
impl<T> Unpin for TracedAsyncRwLock<T>where
T: Unpin,
impl<T> UnsafeUnpin for TracedAsyncRwLock<T>where
T: UnsafeUnpin,
impl<T> UnwindSafe for TracedAsyncRwLock<T>where
T: UnwindSafe,
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