### MinLevel Implementation for Level<5> and Level<3> Source: https://docs.rs/surelock/latest/surelock/level/trait.MinLevel.html?search=std%3A%3Avec Example implementation of MinLevel where self is Level<5> and other is Level<3>. The minimum is Level<3>. ```rust impl MinLevel> for Level<5> { type Min = Level<3>; } ``` -------------------------------- ### MinLevel Implementation for Level<5> and Level<2> Source: https://docs.rs/surelock/latest/surelock/level/trait.MinLevel.html?search=std%3A%3Avec Example implementation of MinLevel where self is Level<5> and other is Level<2>. The minimum is Level<2>. ```rust impl MinLevel> for Level<5> { type Min = Level<2>; } ``` -------------------------------- ### MinLevel Implementation for Level<15> and Level<2> Source: https://docs.rs/surelock/latest/surelock/level/trait.MinLevel.html?search=std%3A%3Avec Example implementation of MinLevel where self is Level<15> and other is Level<2>. The minimum is Level<2>. ```rust impl MinLevel> for Level<15> { type Min = Level<2>; } ``` -------------------------------- ### MinLevel Implementation for Level<7> and Level<2> Source: https://docs.rs/surelock/latest/surelock/level/trait.MinLevel.html?search=std%3A%3Avec Example implementation of MinLevel where self is Level<7> and other is Level<2>. The minimum is Level<2>. ```rust impl MinLevel> for Level<7> { type Min = Level<2>; } ``` -------------------------------- ### MinLevel Implementation for Level<5> and Level<1> Source: https://docs.rs/surelock/latest/surelock/level/trait.MinLevel.html?search=std%3A%3Avec Example implementation of MinLevel where self is Level<5> and other is Level<1>. The minimum is Level<1>. ```rust impl MinLevel> for Level<5> { type Min = Level<1>; } ``` -------------------------------- ### MinLevel Implementation for Level<2> and Level<3> Source: https://docs.rs/surelock/latest/surelock/level/trait.MinLevel.html?search=std%3A%3Avec Example implementation of MinLevel where self is Level<2> and other is Level<3>. The minimum is Level<2>. ```rust impl MinLevel> for Level<2> { type Min = Level<2>; } ``` -------------------------------- ### MinLevel Implementation for Level<10> and Level<2> Source: https://docs.rs/surelock/latest/surelock/level/trait.MinLevel.html?search=std%3A%3Avec Example implementation of MinLevel where self is Level<10> and other is Level<2>. The minimum is Level<2>. ```rust impl MinLevel> for Level<10> { type Min = Level<2>; } ``` -------------------------------- ### MinLevel Implementation for Level<15> and Level<1> Source: https://docs.rs/surelock/latest/surelock/level/trait.MinLevel.html?search=std%3A%3Avec Example implementation of MinLevel where self is Level<15> and other is Level<1>. The minimum is Level<1>. ```rust impl MinLevel> for Level<15> { type Min = Level<1>; } ``` -------------------------------- ### MinLevel Implementation for Level<1> and Level<3> Source: https://docs.rs/surelock/latest/surelock/level/trait.MinLevel.html?search=std%3A%3Avec Example implementation of MinLevel where self is Level<1> and other is Level<3>. The minimum is Level<1>. ```rust impl MinLevel> for Level<1> { type Min = Level<1>; } ``` -------------------------------- ### MinLevel Implementation for Level<5> and Level<5> Source: https://docs.rs/surelock/latest/surelock/level/trait.MinLevel.html Example implementation of MinLevel where both Self and Other are Level<5>. The minimum level is Level<5>. ```rust impl MinLevel> for Level<5> { type Min = Level<5>; } ``` -------------------------------- ### MinLevel Implementation for Level<7> and Level<1> Source: https://docs.rs/surelock/latest/surelock/level/trait.MinLevel.html?search=std%3A%3Avec Example implementation of MinLevel where self is Level<7> and other is Level<1>. The minimum is Level<1>. ```rust impl MinLevel> for Level<7> { type Min = Level<1>; } ``` -------------------------------- ### MinLevel Implementation for Level<15> and Level<15> Source: https://docs.rs/surelock/latest/surelock/level/trait.MinLevel.html Example implementation of MinLevel where both Self and Other are Level<15>. The minimum level is Level<15>. ```rust impl MinLevel> for Level<15> { type Min = Level<15>; } ``` -------------------------------- ### MinLevel Implementation for Level<8> and Level<2> Source: https://docs.rs/surelock/latest/surelock/level/trait.MinLevel.html?search=std%3A%3Avec Example implementation of MinLevel where self is Level<8> and other is Level<2>. The minimum is Level<2>. ```rust impl MinLevel> for Level<8> { type Min = Level<2>; } ``` -------------------------------- ### MinLevel Implementation for Level<10> and Level<1> Source: https://docs.rs/surelock/latest/surelock/level/trait.MinLevel.html?search=std%3A%3Avec Example implementation of MinLevel where self is Level<10> and other is Level<1>. The minimum is Level<1>. ```rust impl MinLevel> for Level<10> { type Min = Level<1>; } ``` -------------------------------- ### MinLevel Implementation for Level<15> and Level<10> Source: https://docs.rs/surelock/latest/surelock/level/trait.MinLevel.html Example implementation of MinLevel where Self is Level<15> and Other is Level<10>. The minimum level is Level<10>. ```rust impl MinLevel> for Level<15> { type Min = Level<10>; } ``` -------------------------------- ### MinLevel Implementation for Level<1> and Level<2> Source: https://docs.rs/surelock/latest/surelock/level/trait.MinLevel.html?search=std%3A%3Avec Example implementation of MinLevel where self is Level<1> and other is Level<2>. The minimum is Level<1>. ```rust impl MinLevel> for Level<1> { type Min = Level<1>; } ``` -------------------------------- ### MinLevel Implementation for Level<6> and Level<2> Source: https://docs.rs/surelock/latest/surelock/level/trait.MinLevel.html?search=std%3A%3Avec Example implementation of MinLevel where self is Level<6> and other is Level<2>. The minimum is Level<2>. ```rust impl MinLevel> for Level<6> { type Min = Level<2>; } ``` -------------------------------- ### MinLevel Implementation for Level<15> and Level<12> Source: https://docs.rs/surelock/latest/surelock/level/trait.MinLevel.html Example implementation of MinLevel where Self is Level<15> and Other is Level<12>. The minimum level is Level<12>. ```rust impl MinLevel> for Level<15> { type Min = Level<12>; } ``` -------------------------------- ### MinLevel Implementation for Level<12> and Level<2> Source: https://docs.rs/surelock/latest/surelock/level/trait.MinLevel.html?search=std%3A%3Avec Example implementation of MinLevel where self is Level<12> and other is Level<2>. The minimum is Level<2>. ```rust impl MinLevel> for Level<12> { type Min = Level<2>; } ``` -------------------------------- ### MinLevel Implementation for Level<9> and Level<2> Source: https://docs.rs/surelock/latest/surelock/level/trait.MinLevel.html?search=std%3A%3Avec Example implementation of MinLevel where self is Level<9> and other is Level<2>. The minimum is Level<2>. ```rust impl MinLevel> for Level<9> { type Min = Level<2>; } ``` -------------------------------- ### MinLevel Implementation for Level<11> and Level<2> Source: https://docs.rs/surelock/latest/surelock/level/trait.MinLevel.html?search=std%3A%3Avec Example implementation of MinLevel where self is Level<11> and other is Level<2>. The minimum is Level<2>. ```rust impl MinLevel> for Level<11> { type Min = Level<2>; } ``` -------------------------------- ### MinLevel Implementation for Level<4> and Level<2> Source: https://docs.rs/surelock/latest/surelock/level/trait.MinLevel.html?search=std%3A%3Avec Example implementation of MinLevel where self is Level<4> and other is Level<2>. The minimum is Level<2>. ```rust impl MinLevel> for Level<4> { type Min = Level<2>; } ``` -------------------------------- ### MinLevel Implementation for Level<8> and Level<1> Source: https://docs.rs/surelock/latest/surelock/level/trait.MinLevel.html?search=std%3A%3Avec Example implementation of MinLevel where self is Level<8> and other is Level<1>. The minimum is Level<1>. ```rust impl MinLevel> for Level<8> { type Min = Level<1>; } ``` -------------------------------- ### MinLevel Implementation for Level<6> and Level<1> Source: https://docs.rs/surelock/latest/surelock/level/trait.MinLevel.html?search=std%3A%3Avec Example implementation of MinLevel where self is Level<6> and other is Level<1>. The minimum is Level<1>. ```rust impl MinLevel> for Level<6> { type Min = Level<1>; } ``` -------------------------------- ### MinLevel Implementation for Level<13> and Level<2> Source: https://docs.rs/surelock/latest/surelock/level/trait.MinLevel.html?search=std%3A%3Avec Example implementation of MinLevel where self is Level<13> and other is Level<2>. The minimum is Level<2>. ```rust impl MinLevel> for Level<13> { type Min = Level<2>; } ``` -------------------------------- ### MinLevel Implementation for Level<14> and Level<2> Source: https://docs.rs/surelock/latest/surelock/level/trait.MinLevel.html?search=std%3A%3Avec Example implementation of MinLevel where self is Level<14> and other is Level<2>. The minimum is Level<2>. ```rust impl MinLevel> for Level<14> { type Min = Level<2>; } ``` -------------------------------- ### MinLevel Implementation for Level<12> and Level<1> Source: https://docs.rs/surelock/latest/surelock/level/trait.MinLevel.html?search=std%3A%3Avec Example implementation of MinLevel where self is Level<12> and other is Level<1>. The minimum is Level<1>. ```rust impl MinLevel> for Level<12> { type Min = Level<1>; } ``` -------------------------------- ### MinLevel Implementation for Level<15> and Level<11> Source: https://docs.rs/surelock/latest/surelock/level/trait.MinLevel.html Example implementation of MinLevel where Self is Level<15> and Other is Level<11>. The minimum level is Level<11>. ```rust impl MinLevel> for Level<15> { type Min = Level<11>; } ``` -------------------------------- ### MinLevel Implementation for Level<9> and Level<1> Source: https://docs.rs/surelock/latest/surelock/level/trait.MinLevel.html?search=std%3A%3Avec Example implementation of MinLevel where self is Level<9> and other is Level<1>. The minimum is Level<1>. ```rust impl MinLevel> for Level<9> { type Min = Level<1>; } ``` -------------------------------- ### Quick Start: Lock a Mutex Source: https://docs.rs/surelock/latest/index.html A basic example demonstrating how to lock a Mutex and increment its value within a lock scope. This is the simplest way to use Surelock for single mutex operations. ```rust use surelock::{key::lock_scope, mutex::Mutex}; let counter: Mutex = Mutex::new(0); lock_scope(|key| { let (mut guard, _key) = key.lock(&counter); *guard += 1; }); ``` -------------------------------- ### MinLevel Implementation for Level<4> and Level<1> Source: https://docs.rs/surelock/latest/surelock/level/trait.MinLevel.html?search=std%3A%3Avec Example implementation of MinLevel where self is Level<4> and other is Level<1>. The minimum is Level<1>. ```rust impl MinLevel> for Level<4> { type Min = Level<1>; } ``` -------------------------------- ### try_lock_scope Example Usage Source: https://docs.rs/surelock/latest/surelock/key/fn.try_lock_scope.html An example demonstrating how to use try_lock_scope to acquire a lock within a scope and modify a shared counter. ```APIDOC ## §Examples ```rust use surelock::{key::try_lock_scope, mutex::Mutex}; let counter: Mutex = Mutex::new(0); let result = try_lock_scope(|key| { let (mut guard, _key) = key.lock(&counter); *guard += 1; }); match result { Some(()) => { /* success */ } // The closure returns () in this example None => { /* already inside a scope */ } } ``` ``` -------------------------------- ### MinLevel Implementation for Level<11> and Level<1> Source: https://docs.rs/surelock/latest/surelock/level/trait.MinLevel.html?search=std%3A%3Avec Example implementation of MinLevel where self is Level<11> and other is Level<1>. The minimum is Level<1>. ```rust impl MinLevel> for Level<11> { type Min = Level<1>; } ``` -------------------------------- ### MinLevel Implementation for Level<15> and Level<5> Source: https://docs.rs/surelock/latest/surelock/level/trait.MinLevel.html Example implementation of MinLevel where Self is Level<15> and Other is Level<5>. The minimum level is Level<5>. ```rust impl MinLevel> for Level<15> { type Min = Level<5>; } ``` -------------------------------- ### Example Searches Source: https://docs.rs/surelock/latest/surelock/acquirable/trait.Acquirable.html?search= Illustrates common search patterns. These examples demonstrate how to search for specific types, type conversions, and generic type transformations. ```text std::vec ``` ```text u32 -> bool ``` ```text Option, (T -> U) -> Option ``` ```text std::vec ``` ```text u32 -> bool ``` ```text Option, (T -> U) -> Option ``` ```text std::vec ``` ```text u32 -> bool ``` ```text Option, (T -> U) -> Option ``` -------------------------------- ### MinLevel Implementation for Level<15> and Level<13> Source: https://docs.rs/surelock/latest/surelock/level/trait.MinLevel.html Example implementation of MinLevel where Self is Level<15> and Other is Level<13>. The minimum level is Level<13>. ```rust impl MinLevel> for Level<15> { type Min = Level<13>; } ``` -------------------------------- ### Mutex with Custom Backend Example Source: https://docs.rs/surelock/latest/src/surelock/mutex.rs.html?search=std%3A%3Avec Illustrates creating a Mutex with a custom backend (SpinMutex) and a specific level. This example is marked as ignore, likely due to external dependencies not present in the snippet. ```rust type M = Mutex>; let counter: M = Mutex::new(0); ``` -------------------------------- ### MinLevel Implementation for Level<7> and Level<5> Source: https://docs.rs/surelock/latest/surelock/level/trait.MinLevel.html Example implementation of MinLevel where Self is Level<7> and Other is Level<5>. The minimum level is Level<5>. ```rust impl MinLevel> for Level<7> { type Min = Level<5>; } ``` -------------------------------- ### Get Mutex ID Source: https://docs.rs/surelock/latest/surelock/mutex/struct.Mutex.html?search=Option%3CT%3E%2C+%28T+-%3E+U%29+-%3E+Option%3CU%3E Returns this mutex’s unique `LockId`. ```rust pub const fn id(&self) -> LockId ``` -------------------------------- ### Any Trait Implementation Source: https://docs.rs/surelock/latest/surelock/level/struct.Bottom.html Implements the Any trait, providing a way to get the TypeId of a value. ```rust fn type_id(&self) -> TypeId ``` -------------------------------- ### MinLevel Implementation for Level<15> and Level<3> Source: https://docs.rs/surelock/latest/surelock/level/trait.MinLevel.html Example implementation of MinLevel where Self is Level<15> and Other is Level<3>. The minimum level is Level<3>. ```rust impl MinLevel> for Level<15> { type Min = Level<3>; } ``` -------------------------------- ### Consume Mutex to Get Inner Data Source: https://docs.rs/surelock/latest/surelock/mutex/struct.Mutex.html?search=Option%3CT%3E%2C+%28T+-%3E+U%29+-%3E+Option%3CU%3E Consumes the mutex and returns the inner data. ```rust pub fn into_inner(self) -> T ``` -------------------------------- ### Getting Mutex ID Source: https://docs.rs/surelock/latest/src/surelock/mutex.rs.html Demonstrates how to retrieve the unique LockId associated with a Mutex instance. ```rust pub const fn id(&self) -> LockId { self.id } ``` -------------------------------- ### MinLevel Implementation for Level<10> and Level<5> Source: https://docs.rs/surelock/latest/surelock/level/trait.MinLevel.html Example implementation of MinLevel where Self is Level<10> and Other is Level<5>. The minimum level is Level<5>. ```rust impl MinLevel> for Level<10> { type Min = Level<5>; } ``` -------------------------------- ### Get Remaining Vouchers Source: https://docs.rs/surelock/latest/surelock/locksmith/struct.Locksmith.html Returns the number of vouchers that can still be issued, or None if the Locksmith is unlimited. ```rust pub fn remaining(&self) -> Option ``` -------------------------------- ### Get Locksmith Voucher Limit Source: https://docs.rs/surelock/latest/surelock/locksmith/struct.Locksmith.html Returns the configured voucher limit for this Locksmith, or None if it is unlimited. ```rust pub const fn limit(&self) -> Option ``` -------------------------------- ### MinLevel Implementation for Level<7> and Level<3> Source: https://docs.rs/surelock/latest/surelock/level/trait.MinLevel.html Example implementation of MinLevel where Self is Level<7> and Other is Level<3>. The minimum level is Level<3>. ```rust impl MinLevel> for Level<7> { type Min = Level<3>; } ``` -------------------------------- ### Get Number of Issued Vouchers Source: https://docs.rs/surelock/latest/surelock/locksmith/struct.Locksmith.html Returns the total number of vouchers issued so far. This counter only increments. ```rust pub fn issued(&self) -> usize ``` -------------------------------- ### NewHigher Example Source: https://docs.rs/surelock/latest/src/surelock/level.rs.html?search=Option%3CT%3E%2C+%28T+-%3E+U%29+-%3E+Option%3CU%3E Illustrates how to create a child mutex ordered after one or more parent mutexes using the `NewHigher` trait. ```APIDOC ## NewHigher Trait Usage ### Description The `NewHigher` trait allows for the creation of a child mutex whose level is automatically determined as the maximum of its parent levels plus one. This is useful for establishing hierarchical lock ordering. ### Method `new_higher(&self, data: ChildT) -> crate::mutex::Mutex` ### Parameters - **data** (ChildT) - The data to be contained within the new child mutex. ### Returns - `crate::mutex::Mutex` - A new mutex instance at the next hierarchical level. ### Example ```rust use surelock::{level::NewHigher, mutex::Mutex}; let config: Mutex = Mutex::new(10); let account = config.new_higher(20u32); // Level<1> let txn = account.new_higher(30u32); // Level<2> ``` ``` -------------------------------- ### Get Number of Issued Vouchers Source: https://docs.rs/surelock/latest/src/surelock/locksmith.rs.html Returns the total number of key vouchers issued so far. This method is thread-safe. ```rust pub fn issued(&self) -> usize { self.issued.load(Ordering::Relaxed) } ``` -------------------------------- ### MinLevel Implementation for Level<8> and Level<5> Source: https://docs.rs/surelock/latest/surelock/level/trait.MinLevel.html Example implementation of MinLevel where Self is Level<8> and Other is Level<5>. The minimum level is Level<5>. ```rust impl MinLevel> for Level<8> { type Min = Level<5>; } ``` -------------------------------- ### Get Configured Voucher Limit Source: https://docs.rs/surelock/latest/src/surelock/locksmith.rs.html Returns the maximum number of vouchers that can be issued. Returns `None` if there is no limit (unlimited issuance). ```rust pub const fn limit(&self) -> Option { self.limit } ``` -------------------------------- ### MinLevel Implementation for Level<15> and Level<7> Source: https://docs.rs/surelock/latest/surelock/level/trait.MinLevel.html Example implementation of MinLevel where Self is Level<15> and Other is Level<7>. The minimum level is Level<7>. ```rust impl MinLevel> for Level<15> { type Min = Level<7>; } ``` -------------------------------- ### Receiver Trait Implementation Example Source: https://docs.rs/surelock/latest/surelock/mutex/guard/struct.MutexGuard.html Shows the Receiver trait, which is an experimental API for calling methods on a target type through a dereferencing receiver. ```rust type Target = T; // Note: This is a nightly-only experimental API. ``` -------------------------------- ### TryInto Implementation Example Source: https://docs.rs/surelock/latest/surelock/mutex/guard/struct.MutexGuard.html Demonstrates the TryInto trait implementation, which allows attempting a conversion from one type to another, returning a Result. ```rust type Error = >::Error; fn try_into(self) -> Result>::Error> ``` -------------------------------- ### Mutex Usage Example Source: https://docs.rs/surelock/latest/src/surelock/mutex.rs.html?search=std%3A%3Avec Demonstrates basic usage of the Mutex with lock_scope for acquiring a lock and modifying data. Requires the 'std' feature. ```rust #![allow(unsafe_code)] use core::{cell::UnsafeCell, fmt, marker::PhantomData}; use crate::{id::LockId, level::IsLevel, raw_mutex::RawMutex}; #[cfg(feature = "std")] use crate::level::Base; #[cfg(feature = "escape-hatch")] use guard::MutexGuard; /// A deadlock-free mutex generic over lock level and backend. /// /// `T` is the protected data. `Lvl` defaults to [`Base`] (= /// `Level<0>`) -- levels are opt-in for incremental cross-level /// acquisition. `R` defaults to /// [`StdMutex`](crate::raw_mutex::std_mutex::StdMutex) on `std`. /// /// Specify just the level to use the default backend: /// `Mutex>`. /// /// All ordered locking goes through /// [`MutexKey::lock`](crate::key::MutexKey::lock). There is no public /// `lock()` method unless the `escape-hatch` feature is enabled. /// /// # Examples /// /// ```rust /// use surelock::{key::lock_scope, mutex::Mutex}; /// /// let counter: Mutex = Mutex::new(0); /// /// lock_scope(|key| { /// let (mut guard, _key) = key.lock(&counter); /// *guard += 1; /// }); /// ``` #[cfg(feature = "std")] pub struct Mutex { id: LockId, pub(crate) raw: R, pub(crate) data: UnsafeCell, _level: PhantomData, } /// A deadlock-free mutex generic over lock level and backend. /// /// `T` is the protected data. `Lvl` defaults to [`Base`] (= /// `Level<0>`). `R` is any [`RawMutex`] implementation. /// /// Enable the `std` feature (on by default) for a default `R` /// parameter, allowing `Mutex` or `Mutex>` /// without naming the backend. /// /// # Examples /// /// ```rust,ignore /// use surelock::{key::lock_scope, mutex::Mutex}; /// /// type M = Mutex>; /// let counter: M = Mutex::new(0); /// ``` #[cfg(not(feature = "std"))] pub struct Mutex { id: LockId, pub(crate) raw: R, pub(crate) data: UnsafeCell, _level: PhantomData, } impl Mutex { /// Create a new mutex with the given data. /// /// A unique [`LockId`] is assigned from a global atomic counter. #[must_use] pub fn new(data: T) -> Self { Self { id: LockId::next(), raw: RawMutex::new(), data: UnsafeCell::new(data), _level: PhantomData, } } /// Returns this mutex's unique [`LockId`]. #[must_use] pub const fn id(&self) -> LockId { self.id } /// Exclusive access via `&mut` -- no locking needed. /// /// Since the caller has exclusive ownership, no other thread can /// be holding the lock. #[must_use] pub const fn get_mut(&mut self) -> &mut T { self.data.get_mut() } /// Consume the mutex and return the inner data. #[must_use] pub fn into_inner(self) -> T { self.data.into_inner() } } // -- new_higher: ordered construction with inferred level -- /// Associated function for creating mutexes ordered after existing /// ones, using the default `StdMutex` backend. /// /// For custom backends, use the [`NewHigher`] trait method instead: /// `parent.new_higher(data)`. #[cfg(feature = "std")] impl Mutex { /// Create a new mutex ordered after one or more parents. /// /// The new mutex's level is `max(parent levels) + 1`. Accepts /// a single `&Mutex` or a tuple of `&Mutex` references. /// Smart-pointer wrappers (`Arc`, `Rc`, `Box`) are also accepted. /// /// Uses the default `StdMutex` backend. For custom backends, use /// the [`NewHigher`] trait method: `parent.new_higher(data)`, /// which inherits the backend from the parent. /// /// # Examples /// /// ```rust /// use surelock::{key::lock_scope, mutex::Mutex}; /// /// let counter: Mutex = Mutex::new(0); /// /// lock_scope(|key| { /// let (mut guard, _key) = key.lock(&counter); /// *guard += 1; /// }); /// ``` ``` -------------------------------- ### Quick Start: Lock and Increment a Mutex Source: https://docs.rs/surelock/latest/src/surelock/lib.rs.html Demonstrates the basic usage of Surelock to lock a Mutex and modify its value within a scope. ```rust use surelock::{key::lock_scope, mutex::Mutex}; let counter: Mutex = Mutex::new(0); lock_scope(|key| { let (mut guard, _key) = key.lock(&counter); *guard += 1; }); ``` -------------------------------- ### MinLevel Implementation for Level<10> and Level<3> Source: https://docs.rs/surelock/latest/surelock/level/trait.MinLevel.html Example implementation of MinLevel where Self is Level<10> and Other is Level<3>. The minimum level is Level<3>. ```rust impl MinLevel> for Level<10> { type Min = Level<3>; } ``` -------------------------------- ### MinLevel Implementation for Level<8> and Level<3> Source: https://docs.rs/surelock/latest/surelock/level/trait.MinLevel.html Example implementation of MinLevel where Self is Level<8> and Other is Level<3>. The minimum level is Level<3>. ```rust impl MinLevel> for Level<8> { type Min = Level<3>; } ``` -------------------------------- ### MinLevel Implementation for Level<14> and Level<14> Source: https://docs.rs/surelock/latest/surelock/level/trait.MinLevel.html Example implementation of MinLevel where both Self and Other are Level<14>. The minimum level is Level<14>. ```rust impl MinLevel> for Level<14> { type Min = Level<14>; } ``` -------------------------------- ### MinLevel Implementation for Level<13> and Level<13> Source: https://docs.rs/surelock/latest/surelock/level/trait.MinLevel.html Example implementation of MinLevel where both Self and Other are Level<13>. The minimum level is Level<13>. ```rust impl MinLevel> for Level<13> { type Min = Level<13>; } ``` -------------------------------- ### TryFrom Implementation Example Source: https://docs.rs/surelock/latest/surelock/mutex/guard/struct.MutexGuard.html Shows the TryFrom trait implementation, enabling fallible conversions from a source type to a target type, returning a Result. ```rust type Error = Infallible; fn try_from(value: U) -> Result>::Error> ``` -------------------------------- ### MinLevel Implementation for Level<12> and Level<12> Source: https://docs.rs/surelock/latest/surelock/level/trait.MinLevel.html Example implementation of MinLevel where both Self and Other are Level<12>. The minimum level is Level<12>. ```rust impl MinLevel> for Level<12> { type Min = Level<12>; } ``` -------------------------------- ### MinLevel Implementation for Level<15> and Level<6> Source: https://docs.rs/surelock/latest/surelock/level/trait.MinLevel.html Example implementation of MinLevel where Self is Level<15> and Other is Level<6>. The minimum level is Level<6>. ```rust impl MinLevel> for Level<15> { type Min = Level<6>; } ``` -------------------------------- ### MinLevel Implementation for Level<11> and Level<11> Source: https://docs.rs/surelock/latest/surelock/level/trait.MinLevel.html Example implementation of MinLevel where both Self and Other are Level<11>. The minimum level is Level<11>. ```rust impl MinLevel> for Level<11> { type Min = Level<11>; } ``` -------------------------------- ### MinLevel Implementation for Level<15> and Level<9> Source: https://docs.rs/surelock/latest/surelock/level/trait.MinLevel.html Example implementation of MinLevel where Self is Level<15> and Other is Level<9>. The minimum level is Level<9>. ```rust impl MinLevel> for Level<15> { type Min = Level<9>; } ``` -------------------------------- ### MinLevel Implementation for Level<10> and Level<10> Source: https://docs.rs/surelock/latest/surelock/level/trait.MinLevel.html Example implementation of MinLevel where both Self and Other are Level<10>. The minimum level is Level<10>. ```rust impl MinLevel> for Level<10> { type Min = Level<10>; } ``` -------------------------------- ### MinLevel Implementation for Level<9> and Level<9> Source: https://docs.rs/surelock/latest/surelock/level/trait.MinLevel.html Example implementation of MinLevel where both Self and Other are Level<9>. The minimum level is Level<9>. ```rust impl MinLevel> for Level<9> { type Min = Level<9>; } ``` -------------------------------- ### MinLevel Implementation for Level<8> and Level<8> Source: https://docs.rs/surelock/latest/surelock/level/trait.MinLevel.html Example implementation of MinLevel where both Self and Other are Level<8>. The minimum level is Level<8>. ```rust impl MinLevel> for Level<8> { type Min = Level<8>; } ``` -------------------------------- ### MinLevel Implementation for Level<11> and Level<5> Source: https://docs.rs/surelock/latest/surelock/level/trait.MinLevel.html Example implementation of MinLevel where Self is Level<11> and Other is Level<5>. The minimum level is Level<5>. ```rust impl MinLevel> for Level<11> { type Min = Level<5>; } ``` -------------------------------- ### MinLevel Implementation for Level<9> and Level<5> Source: https://docs.rs/surelock/latest/surelock/level/trait.MinLevel.html Example implementation of MinLevel where Self is Level<9> and Other is Level<5>. The minimum level is Level<5>. ```rust impl MinLevel> for Level<9> { type Min = Level<5>; } ``` -------------------------------- ### MinLevel Implementation for Level<7> and Level<7> Source: https://docs.rs/surelock/latest/surelock/level/trait.MinLevel.html Example implementation of MinLevel where both Self and Other are Level<7>. The minimum level is Level<7>. ```rust impl MinLevel> for Level<7> { type Min = Level<7>; } ``` -------------------------------- ### MinLevel Implementation for Level<12> and Level<5> Source: https://docs.rs/surelock/latest/surelock/level/trait.MinLevel.html Example implementation of MinLevel where Self is Level<12> and Other is Level<5>. The minimum level is Level<5>. ```rust impl MinLevel> for Level<12> { type Min = Level<5>; } ``` -------------------------------- ### MinLevel Implementation for Level<6> and Level<6> Source: https://docs.rs/surelock/latest/surelock/level/trait.MinLevel.html Example implementation of MinLevel where both Self and Other are Level<6>. The minimum level is Level<6>. ```rust impl MinLevel> for Level<6> { type Min = Level<6>; } ``` -------------------------------- ### MinLevel Implementation for Level<15> and Level<8> Source: https://docs.rs/surelock/latest/surelock/level/trait.MinLevel.html Example implementation of MinLevel where Self is Level<15> and Other is Level<8>. The minimum level is Level<8>. ```rust impl MinLevel> for Level<15> { type Min = Level<8>; } ```