Crates.io | ringu |
lib.rs | ringu |
version | 0.1.1 |
source | src |
created_at | 2020-06-19 14:29:46.821773 |
updated_at | 2020-06-19 14:29:46.821773 |
description | Thread-safe no_std ring buffer |
homepage | |
repository | https://github.com/tstellanova/ringu-rs |
max_upload_size | |
id | 255718 |
size | 10,680 |
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.
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