A simple rust no_std ring buffer. The intent is to be thread-safe, possibly multi-producer, multi-consumer. This is work in progress and YMMV.
rust
let mut buf = Ringu::default();
let mut push_count = 0;
for i in 0..128 {
push_count += buf.push_one(i as u8);
}
assert_eq!(push_count, 128);
let mut read_count = 0;
for i in 0..128) {
let (nread, _val) = buf.read_one();
read_count += nread;
}
assert_eq!(read_count, 128);
BSD-3: See LICENSE file