9 releases
0.1.8 | Nov 6, 2024 |
---|---|
0.1.7 | Jul 23, 2024 |
#1028 in Parser implementations
946 downloads per month
Used in 2 crates
(via cellular_raza-core)
20KB
375 lines
circ_buffer
A no_std
crate for a fixed-size statically allocated ring-buffer with optional serde
(De)-Serialization.
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