que-luyo
que-luyo is a dependency-free transactional FIFO queue for taking
bite-sized batches without losing work.
The Pakutsuku principle
This crate gives a concrete meaning to パクつく理:
Take only one manageable bite, keep its original order, commit it after success, and put it back untouched when success is not declared.
A Bite temporarily borrows its source queue. Calling commit permanently
removes the items. Calling rollback, returning early, unwinding from a
panic, or simply dropping the bite restores every item to the front in its
original order.
Example
use BiteQueue;
let mut queue = from_iter;
assert_eq!;
let committed = queue.bite_exact?.commit;
assert_eq!;
assert_eq!;
# Ok::
Guarantees
- FIFO order is preserved.
- A bite never contains more than its requested maximum.
- Exact bites fail without changing the queue when too few items exist.
- Uncommitted bites automatically roll back.
- Zero-sized requests are rejected.
- The implementation uses only the Rust standard library.
License
MIT