#ring-buffer #index #no-std #api #fifo-queue #power #system

no-std rbi

A FIFO index queue that can be used for implementing a ring buffer

2 releases

0.1.1 Apr 27, 2022
0.1.0 Apr 27, 2022

#2401 in Algorithms

MIT/Apache

8KB
153 lines

About

This library is part of RIOT-rs.

This module provides a FIFO index queue that can be used for implementing a ring buffer. It works in no_std settings.

It keeps track of indexes from 0..N (with N being a power of two).

put() marks an index "used".

get() returns an indexe that has been put() (if any) and marks it unused.

peek() returns the index that get() would return next (if any) without marking it unused.

All operations are O(1).


lib.rs:

This module provides a FIFO index queue that can be used for implementing a ring buffer.

It keeps track of indexes from 0..N (with N being a power of two).

put() marks an index "used". get() returns an indexe that has been put() (if any) and marks it unused. peek() returns the index that get() would return next (if any) without marking it unused.

All operations are O(1).

No runtime deps