ring_buffer

Attribute Macro ring_buffer 

Source
#[ring_buffer]
Expand description

Transforms a struct with a Vec<T> field into a fixed-size FIFO ring buffer.

§Example

#[ring_buffer(10)]
struct MyBuffer {
    data: Vec<String>,
}

Adds fields: capacity, head, tail, size

Generates methods: new(), enqueue(), dequeue(), is_full(), is_empty(), len(), capacity(), clear()