microlock 0.3.1

A crate for waiting: Small locks and other timing things!
Documentation
#[deny(clippy::missing_const_for_fn)]
mod timed;
pub mod timer;
mod untimed;
pub use timed::*;
use timer::TimerDuration;
pub use untimed::*;

pub trait Lock {
    /// Returns if the lock is (still) locked.
    fn is_locked(&self) -> bool;
    /// Locks the lock indefinitely. In case of a timed one, the previous
    /// target will be replaced without releasing the waiting threads.
    fn lock(&self);
    /// Locks the lock indefinitely like [`Lock::lock`], UNLESS unlock was
    /// called more than once. If someone tried to unlock the lock while it was
    /// already unlocked, this will NOT lock it. Returns false and resets
    /// the double-unlock check if the locking failed.
    fn try_lock(&self) -> bool;
    /// Unlocks the lock and releases all waiting threads.
    fn unlock(&self);
    /// Makes the current thread wait on this lock until it is
    /// unlocked (or expires).
    fn wait_here(&self);
    /// Makes the current thread wait on this lock until it is unlocked (or
    /// expires) or the timeout expires.
    fn wait_here_for(&self, timeout: TimerDuration);
    fn wait_here_for_ms(&self, timeout_ms: u64);
}