Re: [PATCH v5] rust: rbtree: add immutable cursor

From: Miguel Ojeda
Date: Sun Nov 16 2025 - 17:34:57 EST


On Tue, Oct 14, 2025 at 2:33 PM Vitaly Wool <vitaly.wool@xxxxxxxxxxx> wrote:
>
> Sometimes we may need to iterate over, or find an element in a read
> only (or read mostly) red-black tree, and in that case we don't need a
> mutable reference to the tree, which we'll however have to take to be
> able to use the current (mutable) cursor implementation.
>
> This patch adds a simple immutable cursor implementation to RBTree,
> which enables us to use an immutable tree reference. The existing
> (fully featured) cursor implementation is renamed to CursorMut,
> while retaining its functionality.
>
> The only existing user of the [mutable] cursor for RBTrees (binder) is
> updated to match the changes.
>
> Signed-off-by: Vitaly Wool <vitaly.wool@xxxxxxxxxxx>

Applied to `rust-next` -- thanks everyone!

[ Applied `rustfmt`. Added intra-doc link. Fixed unclosed example.
Fixed docs description. Fixed typo and other formatting nits.
- Miguel ]

Cheers,
Miguel