Skip to main content

Crate nure_queue

Crate nure_queue 

Source
Expand description

nure-queue: a no_std, allocator-free, lock-free bounded MPMC queue.

A port of Crossbeam’s ArrayQueue (Dmitry Vyukov’s bounded MPMC algorithm) to static storage: no heap, no allocator, constructible in const context so it can live in a static.

use nure_queue::Queue;

let q = Queue::<u32, 8>::new();
q.enqueue(1).unwrap();
q.enqueue(2).unwrap();
assert_eq!(q.dequeue(), Some(1));
assert_eq!(q.dequeue(), Some(2));

Static, allocator-free construction (default build only, demonstrated by static_construction_no_alloc in tests/smoke.rs):

ⓘ
use nure_queue::Queue;

static Q: Queue<u32, 8> = Queue::new();

§Why this exists

heapless::mpmc is deprecated (not truly lock-free — see heapless#583). Crossbeam’s ArrayQueue is correct but heap-allocates on construction. embassy-sync’s channel is static but mutex-based. This crate is the intersection: static + truly lock-free.

§Memory ordering

Same protocol as Crossbeam: slot hand-off via acquire/release stamps, head/tail CAS with SeqCst on success. See push/pop for details.

Structs§

Queue
A bounded lock-free multi-producer multi-consumer queue with static storage.