1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33
//! Traits and implementations for semaphores. mod impls; pub use impls::*; #[cfg(feature = "alloc")] mod r#async; #[cfg(feature = "alloc")] pub use r#async::*; #[cfg(feature = "alloc")] mod async_timeout; #[cfg(feature = "alloc")] pub use async_timeout::*; mod readout; pub use readout::*; mod timeout; pub use timeout::*; mod r#try; pub use r#try::*; /// A generic semaphore. /// /// # Safety /// This trait is marked as unsafe to allow for safe code to rely on the standard semaphore contract. /// [`Default`] implementations should initialize the count at 0. pub unsafe trait Semaphore: TrySemaphore { /// Decrements the count if able or blocks until able. fn wait(&self); }