Trait lock_order::lock::UnlockedAccess

source ·
pub trait UnlockedAccess<A> {
    type Data;
    type Guard<'l>: Deref<Target = Self::Data>
       where Self: 'l;

    // Required method
    fn access(&self) -> Self::Guard<'_>;
}
Expand description

Describes how to access state in Self that doesn’t require locking.

UnlockedAccess allows access to some state in Self without acquiring a lock. Unlike Lock and friends, the type parameter A in UnlockedAccess<A> is used to provide a label for the state; it is unrelated to the lock levels for Self.

In order for this crate to provide guarantees about lock ordering safety, UnlockedAccess must only be implemented for accessing state that is guaranteed to be accessible lock-free.

Required Associated Types§

source

type Data

The type of state being accessed.

source

type Guard<'l>: Deref<Target = Self::Data> where Self: 'l

A guard providing read access to the data.

Required Methods§

source

fn access(&self) -> Self::Guard<'_>

How to access the state.

Object Safety§

This trait is not object safe.

Implementors§

source§

impl<L, T> UnlockedAccess<L> for T

§

type Data = <L as UnlockedAccessMarkerFor<T>>::Data

§

type Guard<'l> = &'l <L as UnlockedAccessMarkerFor<T>>::Data where Self: 'l