pub struct SpinLockGuard<'a, T, G: SpinGuardian> { /* private fields */ }Expand description
A guard that provides exclusive access to the data protected by a SpinLock.
§Verified Properties
§Verification Design
The guard is extended with a ghost permission field v_perm that
holds the ghost permission (PointsTo<T>)
This permission grants exclusive ownership of the protected data and enables verified access to the PCell<T>.
§Invariant
The guard maintains a type invariant ensuring that its ghost permission’s ID matches the lock’s internal cell ID. This guarantees that the permission corresponds to the correct protected data.
#[verifier::type_invariant]
spec fn type_inv(self) -> bool{
self.lock.cell_id() == self.v_perm@.id()
}Note: The invariant is encapsulated using the #[verifier::type_invariant] mechanism.
It internally holds at all steps during the method executions and is NOT exposed in the public APIs’ pre- and post-conditions.
Implementations§
Source§impl<'a, T, G: SpinGuardian> SpinLockGuard<'a, T, G>
impl<'a, T, G: SpinGuardian> SpinLockGuard<'a, T, G>
Trait Implementations§
Source§impl<T, G: SpinGuardian> Deref for SpinLockGuard<'_, T, G>
impl<T, G: SpinGuardian> Deref for SpinLockGuard<'_, T, G>
Source§impl<T, G: SpinGuardian> DerefMut for SpinLockGuard<'_, T, G>
impl<T, G: SpinGuardian> DerefMut for SpinLockGuard<'_, T, G>
impl<T: ?Sized, G: SpinGuardian> !Send for SpinLockGuard<'_, T, G>
impl<T: Sync, G: SpinGuardian> Sync for SpinLockGuard<'_, T, G>
Auto Trait Implementations§
impl<'a, T, G> Freeze for SpinLockGuard<'a, T, G>
impl<'a, T, G> !RefUnwindSafe for SpinLockGuard<'a, T, G>
impl<'a, T, G> Unpin for SpinLockGuard<'a, T, G>
impl<'a, T, G> !UnwindSafe for SpinLockGuard<'a, T, G>
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