1 unstable release
| 0.1.0 | Oct 18, 2025 |
|---|
#1042 in Concurrency
Used in 5 crates
(2 directly)
53KB
640 lines
Frugal Async
A crate of utilities for async rust, all based on some simplifying assumptions:
- Nothing is cancel-safe.
- No futures are Send.
- Panics always abort.
See Frugal Async Rust for more details.
The "synchronisation primitives" in this crate are not about synchronisation
across threads, but merely to let different parts of programs .await access to
some data.
lib.rs:
This crate provides utilities for writing async Rust code. Unlike many other such crates, it makes a couple of simplifying assumptions:
- no cancel-safety required,
- futures need not be
Send, and - panics always abort the program.
See Frugal Async Rust for more details on these assumptions.
Synchronisation
We provide two .awaitable synchronisation primitives: Mutex provides exclusive access to a wrapped value, and RwLock provides exclusive mutable access or an arbitrary number of concurrent immutable accesses to a wrapped value (think an awaitable RefCell).
Cells
The OnceCell is a cell which starts empty and can be set to a value only once; calling code can .await the moment the cell is set to a value.
The TakeCell is a cell which starts empty, whose contents can be set to any value any number of times, and whocse contents can only be accessed through an async take method which empties the cell (and which is parked when called on a presently-empty cell).
Dependencies
~515KB