Struct bones_lib::prelude::borrow::AtomicBorrowMut
pub struct AtomicBorrowMut<'a> { /* private fields */ }Expand description
Encapsulates exclusive borrowing state.
An instance of this type guarantees that neither AtomicBorrowMut, nor AtomicBorrow cannot be constructed for the same lock.
Implementations§
§impl<'a> AtomicBorrowMut<'a>
impl<'a> AtomicBorrowMut<'a>
pub fn try_new(lock: &'a AtomicIsize) -> Option<AtomicBorrowMut<'a>>
pub fn try_new(lock: &'a AtomicIsize) -> Option<AtomicBorrowMut<'a>>
Attempts to borrow lock mutably.
pub unsafe fn restore_leaked(lock: &'a AtomicIsize) -> AtomicBorrowMut<'a>
pub unsafe fn restore_leaked(lock: &'a AtomicIsize) -> AtomicBorrowMut<'a>
Restore previously leaked AtomicBorrowMut instance.
This method should be called only after forgetting AtomicBorrowMut instance.
Or after locking manually using try_borrow_mut method.
pub fn dummy() -> AtomicBorrowMut<'a>
pub fn dummy() -> AtomicBorrowMut<'a>
Returns dummy atomic borrow that doesn’t actually locks anything.
It is used within RefMut::new method that take external reference.
pub fn clone(&self) -> AtomicBorrowMut<'a>
pub fn clone(&self) -> AtomicBorrowMut<'a>
Borrows can be cloned.
Mutable borrows are cloned when borrowed reference is split into disjoint parts.
There is a hard limit on number of clones for each lock (except dummy lock) and it will panic if cloning fails.
Huge limit value makes it practically unreachable without forgeting clones in a loop.