[<prev] [next>] [<thread-prev] [day] [month] [year] [list]
Message-ID: <CANiq72mHAJvjKkJmOu3EPi7Xy7NiHFPawz32-yxWHKGeaFtjHg@mail.gmail.com>
Date: Sun, 29 Jun 2025 21:31:25 +0200
From: Miguel Ojeda <miguel.ojeda.sandonis@...il.com>
To: Alice Ryhl <aliceryhl@...gle.com>
Cc: Miguel Ojeda <ojeda@...nel.org>, rust-for-linux@...r.kernel.org,
linux-kernel@...r.kernel.org
Subject: Re: [PATCH] rbtree: rust: add RBTree::is_empty
On Mon, Jun 16, 2025 at 12:36 PM Alice Ryhl <aliceryhl@...gle.com> wrote:
>
> In Rust Binder I need to be able to determine whether a red/black tree
> is empty. Thus, add a method for that operation to replace
>
> rbtree.iter().next().is_none()
>
> This is terrible, so add a method for this purpose. We do not add a
> RBTree::len method because computing the number of elements requires
> iterating the entire tree, but checking whether it is empty can be done
> cheaply.
>
> Signed-off-by: Alice Ryhl <aliceryhl@...gle.com>
Applied to `rust-next` -- thanks everyone!
[ Adjusted title. - Miguel ]
Cheers,
Miguel
Powered by blists - more mailing lists