Crate mea

Source
Expand description

§Mea - Make Easy Async

mea is a runtime-agnostic library providing essential synchronization primitives for asynchronous Rust programming. The library offers a collection of well-tested, efficient synchronization tools that work with any async runtime.

§Features

  • Barrier: A synchronization point where multiple tasks can wait until all participants arrive
  • Condvar: A condition variable that allows tasks to wait for a notification
  • Latch: A single-use barrier that allows one or more tasks to wait until a signal is given
  • Mutex: A mutual exclusion primitive for protecting shared data
  • RwLock: A reader-writer lock that allows multiple readers or a single writer at a time
  • Semaphore: A synchronization primitive that controls access to a shared resource
  • ShutdownSend & ShutdownRecv: A composite synchronization primitive for managing shutdown signals
  • WaitGroup: A synchronization primitive that allows waiting for multiple tasks to complete
  • atomicbox: A safe, owning version of AtomicPtr for heap-allocated data.
  • mpsc::unbounded: A multi-producer, single-consumer unbounded queue for sending values between asynchronous tasks.
  • oneshot::channel: A one-shot channel for sending a single value between tasks.

§Runtime Agnostic

All synchronization primitives in this library are runtime-agnostic, meaning they can be used with any async runtime like Tokio, async-std, or others. This makes the library highly versatile and portable.

§Thread Safety

All types in this library implement Send and Sync, making them safe to share across thread boundaries. This is essential for concurrent programming where data needs to be accessed from multiple threads.

Modules§

atomicbox
AtomicBox and AtomicOptionBox are safe, owning versions of std’s AtomicPtr.
barrier
A synchronization primitive that enables multiple tasks to wait for each other.
condvar
A condition variable that allows tasks to wait for a notification.
latch
A countdown latch that allows one or more tasks to wait until a set of operations completes.
mpsc
A multi-producer, single-consumer queue for sending values between asynchronous tasks.
mutex
An async mutex for protecting shared data.
oneshot
A one-shot channel is used for sending a single message between asynchronous tasks. The channel function is used to create a Sender and Receiver handle pair that form the channel.
rwlock
A reader-writer lock that allows multiple readers or a single writer at a time.
semaphore
An async counting semaphore for controlling access to a set of resources.
shutdown
A composite synchronization primitive for managing shutdown signals.
waitgroup
A synchronization primitive for waiting on multiple tasks to complete.