pub struct GlobalLockedBy<T: ?Sized, B: GlobalLockBackend> { /* private fields */ }
Expand description
A version of LockedBy
for a GlobalLock
.
See global_lock!
for examples.
Implementations§
Source§impl<T, B: GlobalLockBackend> GlobalLockedBy<T, B>
impl<T, B: GlobalLockBackend> GlobalLockedBy<T, B>
Sourcepub fn new(val: T) -> Self
pub fn new(val: T) -> Self
Create a new GlobalLockedBy
.
The provided value will be protected by the global lock indicated by B
.
Source§impl<T: ?Sized, B: GlobalLockBackend> GlobalLockedBy<T, B>
impl<T: ?Sized, B: GlobalLockBackend> GlobalLockedBy<T, B>
Sourcepub fn as_ref<'a>(&'a self, _guard: &'a GlobalGuard<B>) -> &'a T
pub fn as_ref<'a>(&'a self, _guard: &'a GlobalGuard<B>) -> &'a T
Access the value immutably.
The caller must prove shared access to the lock.
Sourcepub fn as_mut<'a>(&'a self, _guard: &'a mut GlobalGuard<B>) -> &'a mut T
pub fn as_mut<'a>(&'a self, _guard: &'a mut GlobalGuard<B>) -> &'a mut T
Access the value mutably.
The caller must prove shared exclusive to the lock.
Trait Implementations§
impl<T, B> Send for GlobalLockedBy<T, B>
impl<T, B> Sync for GlobalLockedBy<T, B>
Auto Trait Implementations§
impl<T, B> !Freeze for GlobalLockedBy<T, B>
impl<T, B> !RefUnwindSafe for GlobalLockedBy<T, B>
impl<T, B> Unpin for GlobalLockedBy<T, B>
impl<T, B> UnwindSafe for GlobalLockedBy<T, B>
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