#fixed-size #undo #log #ringbuf

simple_ringbuf

Simple Ringbuf is a speedy lightweight fixed-size infinite-use collection optimized for straightforward single threaded use

3 releases

0.1.2 Jun 13, 2019
0.1.1 Jun 13, 2019
0.1.0 Jun 13, 2019

#2079 in Data structures

Download history 6/week @ 2024-07-25 22/week @ 2024-08-15 19/week @ 2024-08-22 113/week @ 2024-08-29 110/week @ 2024-09-05 151/week @ 2024-09-12 101/week @ 2024-09-19 36/week @ 2024-09-26 76/week @ 2024-10-03 77/week @ 2024-10-10 14/week @ 2024-10-17 89/week @ 2024-10-24 38/week @ 2024-10-31 40/week @ 2024-11-07

183 downloads per month

MIT/Apache

42KB
674 lines

Simple Ringbuf

Build Status Docs License: MIT License: Apache Crate Version

The simple_ringbuf crate provides a lightweight (no dependency) ring buffer backed with a hand-memory managed buffer (with unsafe). Serialization support is optionally available with the serde feature flag.

The sole feature of this create is the RingBuffer struct, which is a fixed-sized collection with an API somewhat similar to standard Rust collections.

The primary intention of this crate is to provide a cheap fixed-sized collection for buffering a finite horizon of data. The use case this was developed for was an action history log for a bot, and could be used for similar concepts like undo logs. In fact, the iterator and Index implementations for this struct assume you want to iterate from the "top" of the deque (newest to oldest), and doesn't allow mutation of elements at this time (but does allow push/popping from both ends).

Most existing ring buffers for Rust such as the ringbuf crate, or the standard library's own VecDeque are specialized for different uses and may fit your needs better.

Dependencies

~165KB