Re: [PATCH v3] rust: add a ring buffer implementation
From: Miguel Ojeda
Date: Tue Nov 10 2026 - 08:44:47 EST
On Thu, Nov 5, 2026 at 11:38 AM Andreas Hindborg <a.hindborg@xxxxxxxxxx> wrote:
>
> +//! A fixed-capacity FIFO ring buffer.
> +//!
> +//! This module provides [`RingBuffer`], a circular buffer implementation that
> +//! supports efficient push and pop operations at opposite ends of the buffer.
Please add at least an example here :) Maybe reusing part of the tests.
i.e. this is simple enough that we can use it as a simple showcase of
how to write a module with docs, examples, and tests.
(And ideally on each method that may fail showing their `Ok`/`Some`
and `Err`/`None` paths.)
> +/// # Invariants
Sashiko seems right: this is missing `// INVARIANT:`.
> + /// Returns `true` if the buffer is full.
[`true`]
> + /// Returns `None` if the buffer is empty. Values are returned in FIFO
[`None`]
Cheers,
Miguel