Re: [PATCH v4 06/11] rust: xarray: add `find_next` and `find_next_mut`
From: Andreas Hindborg
Date: Tue Aug 25 2026 - 08:54:19 EST
Tamir Duberstein <tamird@xxxxxxxxxx> writes:
> On Thu, 04 Jun 2026 21:58:12 +0200, Andreas Hindborg <a.hindborg@xxxxxxxxxx> wrote:
>> Add methods to find the next element in an XArray starting from a
>> given index. The methods return a tuple containing the index where the
>> element was found and a reference to the element.
>>
>> The implementation uses the XArray state API via `xas_find` to avoid taking
>> the rcu lock as an exclusive lock is already held by `Guard`.
>
> The previous patch re-hosts existing XArray methods on XArrayState, but
> this patch and subsequent ones are choosing to grow the XArray API
> rather than promote XArrayState to a proper abstraction that users
> should prefer. Are you sure that's the right choice?
We have the `Entry` API (introduced in patch 7) for users to interact
with the XArray in a stateful manner. I think adding these public
methods on `Guard` makes sense.
Best regards,
Andreas Hindborg