#ring-buffer #statically #optional #allocated #push #fixed-size #serialization

circ_buffer

A bare-metal fixed-size statically allocated ring-buffer with optional serde (De)-Serialization

8 releases

0.1.7 Jul 23, 2024
0.1.6 Jul 23, 2024

#727 in Encoding

Download history 137/week @ 2024-07-15 524/week @ 2024-07-22 406/week @ 2024-07-29 8/week @ 2024-08-12 15/week @ 2024-08-19 86/week @ 2024-08-26 163/week @ 2024-09-02 50/week @ 2024-09-09

314 downloads per month
Used in 2 crates (via cellular_raza-core)

MIT/Apache

19KB
364 lines

circ_buffer


A no_std crate for a fixed-size statically allocated ring-buffer with optional serde (De)-Serialization.

License MIT License Apache Test Status Crate Docs Minimum rustc version


lib.rs:

A const-sized Ring-Buffer datastructure.

The crate is no_std. It uses elements from the standard library for testing purposes but does not rely on them for internal implementation details.

Example

use circ_buffer::RingBuffer;

let mut ring_buffer = RingBuffer::<_, 5>::new();
ring_buffer.push("Aurea prima");
ring_buffer.push("sata est");
ring_buffer.push("aetas, quae");
ring_buffer.push("vindice nullo");
ring_buffer.push("sponte sua,");
ring_buffer.push("sine lege fidem");
ring_buffer.push("rectumque colebat.");

assert_eq!(ring_buffer[0], "aetas, quae");
assert_eq!(ring_buffer[1], "vindice nullo");
assert_eq!(ring_buffer[2], "sponte sua,");
assert_eq!(ring_buffer[3], "sine lege fidem");
assert_eq!(ring_buffer[4], "rectumque colebat.");

Features

  • serde allows for deserialization of the RingBuffer

Dependencies

~165KB