Skip to main content

BaseGuard

Trait BaseGuard 

Source
pub trait BaseGuard {
    type State: Clone + Copy;

    // Required methods
    fn acquire() -> Self::State;
    fn release(state: Self::State);

    // Provided method
    fn lockdep_enabled() -> bool { ... }
}
Expand description

A base trait that all guards implement.

Required Associated Types§

Source

type State: Clone + Copy

The saved state when entering the critical section.

Required Methods§

Source

fn acquire() -> Self::State

Something that must be done before entering the critical section.

Source

fn release(state: Self::State)

Something that must be done after leaving the critical section.

Provided Methods§

Source

fn lockdep_enabled() -> bool

Returns whether locks guarded by this type should participate in lock dependency tracking.

Dyn Compatibility§

This trait is not dyn compatible.

In older versions of Rust, dyn compatibility was called "object safety", so this trait is not object safe.

Implementors§