surelock 0.1.0

Deadlock-free locks for Rust with compile time guarantees, incremental locks, and atomic lock sets.
Documentation
//! Compile-time tests verifying that `Level<N>` types produce the
//! expected `LockAfter` trait bounds.

#![allow(dead_code, clippy::missing_const_for_fn)]

use surelock::level::{Base, Bottom, IsLevel, Level, LockAfter};

type Config = Level<1>;
type Account = Level<2>;
type Transaction = Level<3>;

fn _assert_level_impls()
where
    Config: IsLevel,
    Account: IsLevel,
    Transaction: IsLevel,
{
}

fn _assert_lock_after_bottom()
where
    Config: LockAfter<Bottom>,
    Account: LockAfter<Bottom>,
    Transaction: LockAfter<Bottom>,
{
}

fn _assert_lock_after_base()
where
    Config: LockAfter<Base>,
    Account: LockAfter<Base>,
    Transaction: LockAfter<Base>,
{
}

fn _assert_direct_edges()
where
    Account: LockAfter<Config>,
    Transaction: LockAfter<Account>,
{
}

fn _assert_transitive()
where
    Transaction: LockAfter<Config>,
{
}

fn _assert_skipping()
where
    Level<5>: LockAfter<Level<0>>,
    Level<15>: LockAfter<Level<3>>,
{
}

#[test]
fn lock_levels_compile() {}