#circular-buffer #ring-buffer #circular #buffer #ring #manx

no-std nsrb

Nifty Simple Ring Buffer (aka circular buffer) is a no_std library that provides 2 macros to easily create fixed circular buffer on the stack

1 stable release

1.0.0 Oct 23, 2024

#825 in Data structures

Download history 142/week @ 2024-10-23 5/week @ 2024-10-30 5/week @ 2024-11-06

152 downloads per month

MIT license

34KB
371 lines

ubuntu-latest windows-latest macos-latest

nsrb

Nifty Simple Ring Buffer (aka circular buffer) is a no_std library that provides 2 macros to easily create fixed circular buffer on the stack.

See crate documentation for more informations.

Example

#[macro_use] extern crate nsrb;
 
#[derive(Clone, Copy, Debug)]
pub struct LogEntry {
    pub time_date : usize,
    pub entry : [char;256]
}
 
impl Default for LogEntry {
    fn default() -> Self { LogEntry { time_date : 0, entry : [' ';256] } }
 }

// Create a Ring buffer for LogEntry
nsrb::ring!(#[derive(Debug)] pub(crate) LogChecked[LogEntry; 10]);
 
fn main() {
    let log = LogChecked::new();
}
 

No runtime deps

Features