Expand description
Lock-free SPSC overwrite ring for high-rate telemetry in no-std contexts.
§Overview
- Single producer, single consumer.
- Producer never blocks; new writes overwrite the oldest slots when the ring wraps.
- Sequence numbers are monotonically increasing
u32;0is reserved to mean “empty”. - The consumer can drain in-order (
poll_one/poll_up_to) or sample the newest value (latest). - If the consumer lags by more than
N, it skips ahead and reports the number of dropped items.
§Memory ordering
The producer writes the value, publishes the per-slot sequence, then publishes the newest sequence. The consumer validates the per-slot sequence before and after reading, which avoids torn reads when the producer overwrites a slot.
§Notes
TisCopyto allow returning values by copy without allocation.- The
&Tpassed to hooks is a reference to a local copy made during the read.