pub struct NS_DRAM_REGIONS { /* private fields */ }Methods from Deref<Target = Mutex<Vec<Range<usize>>>>§
pub fn lock(&self) -> MutexGuard<'_, T>
pub fn lock(&self) -> MutexGuard<'_, T>
Locks the [Mutex] and returns a guard that permits access to the inner data.
The returned value may be dereferenced for data access and the lock will be dropped when the guard falls out of scope.
let lock = spin::Mutex::new(0);
{
let mut data = lock.lock();
// The lock is now locked and the data can be accessed
*data += 1;
// The lock is implicitly dropped at the end of the scope
}pub fn is_locked(&self) -> bool
pub fn is_locked(&self) -> bool
Returns true if the lock is currently held.
§Safety
This function provides no synchronization guarantees and so its result should be considered ‘out of date’ the instant it is called. Do not use it for synchronization purposes. However, it may be useful as a heuristic.
pub unsafe fn force_unlock(&self)
pub unsafe fn force_unlock(&self)
Force unlock this [Mutex].
§Safety
This is extremely unsafe if the lock is not held by the current thread. However, this can be useful in some instances for exposing the lock to FFI that doesn’t know how to deal with RAII.
pub fn try_lock(&self) -> Option<MutexGuard<'_, T>>
pub fn try_lock(&self) -> Option<MutexGuard<'_, T>>
Try to lock this [Mutex], returning a lock guard if successful.
§Example
let lock = spin::Mutex::new(42);
let maybe_guard = lock.try_lock();
assert!(maybe_guard.is_some());
// `maybe_guard` is still held, so the second call fails
let maybe_guard2 = lock.try_lock();
assert!(maybe_guard2.is_none());Trait Implementations§
Source§impl Deref for NS_DRAM_REGIONS
impl Deref for NS_DRAM_REGIONS
impl LazyStatic for NS_DRAM_REGIONS
Auto Trait Implementations§
impl Freeze for NS_DRAM_REGIONS
impl RefUnwindSafe for NS_DRAM_REGIONS
impl Send for NS_DRAM_REGIONS
impl Sync for NS_DRAM_REGIONS
impl Unpin for NS_DRAM_REGIONS
impl UnsafeUnpin for NS_DRAM_REGIONS
impl UnwindSafe for NS_DRAM_REGIONS
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