#ring-buffer #deserialize #fixed-size #bare-metal #optional #statically #allocated

circ_buffer

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

9 releases

0.1.8 Nov 6, 2024
0.1.7 Jul 23, 2024

#1028 in Parser implementations

Download history 10/week @ 2024-08-16 67/week @ 2024-08-23 97/week @ 2024-08-30 101/week @ 2024-09-06 40/week @ 2024-09-13 24/week @ 2024-09-20 16/week @ 2024-09-27 4/week @ 2024-10-04 143/week @ 2024-10-11 361/week @ 2024-10-18 582/week @ 2024-10-25 149/week @ 2024-11-01 300/week @ 2024-11-08 277/week @ 2024-11-15 253/week @ 2024-11-22 45/week @ 2024-11-29

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

MIT/Apache

20KB
375 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

~160KB