pub trait OrderedLockAccess<T> {
type Lock;
// Required method
fn ordered_lock_access(&self) -> OrderedLockRef<'_, Self::Lock>;
}
Expand description
Marks a type as offering ordered lock access for some inner type T
.
This trait allows for types that are lock order sensitive to be defined in a separate crate than the lock levels themselves while nudging local code away from using the locks without regards for ordering.
The crate defining the lock levels can implement LockLevelFor
to declare
the lock level to access the field exposed by this implementation.
Required Associated Types§
Sourcetype Lock
type Lock
The lock type that observes ordering.
This should be a type that implements either ExclusiveLock
or
ReadWriteLock
.
Required Methods§
Sourcefn ordered_lock_access(&self) -> OrderedLockRef<'_, Self::Lock>
fn ordered_lock_access(&self) -> OrderedLockRef<'_, Self::Lock>
Returns a borrow to the order-aware lock.
Note that this returns OrderedLockRef
to further prevent out of
order lock usage. Once sealed into OrderedLockRef
, the borrow can
only be used via the blanket RwLockFor
and LockFor
implementations provided by this crate.