loopq
An efficient, single-producer single-consumer (SPSC) lock-free ring buffer for Rust.
Features
- Lock-free: Uses atomic operations for thread-safe access without mutexes.
- no_std: Compatible with bare-metal and embedded environments.
- Async Support:
- Embassy: First-class support for
embassy-rsvia theembassyfeature. - Tokio: Support for
tokiovia thetokiofeature.
- Embassy: First-class support for
- Static Initialization: Can be initialized in
staticcontexts.
Usage
use Buffer;
Async Usage (Tokio)
Enable the tokio feature in your Cargo.toml.
use AsyncBuffer;
async
Static Initialization
loopq is designed for no_std environments and can be statically initialized.
use Buffer;
static BUFFER: = new;
License
Licensed under either of
- MIT license (LICENSE-MIT or http://opensource.org/licenses/MIT)
- Apache License, Version 2.0 (LICENSE-APACHE or http://www.apache.org/licenses/LICENSE-2.0)
at your option.