Re: [PATCH 4/4] rust: xarray: Add Guard::find() helper
From: Alvin Sun
Date: Thu Apr 16 2026 - 22:18:22 EST
On 4/17/26 09:18, Matthew Wilcox wrote:
On Fri, Apr 17, 2026 at 09:05:54AM +0800, Alvin Sun wrote:
Add a helper to find the first present entry in the XArray.Why would you expose a function which does striclty less than the
underlying C implementation, rather than exposing all the functionality
that xa_find does?
Returns the index of the first present entry, or None if the arrayWhy not return the value found, like xa_find() does?
is empty.
Hi Matthew,
Thanks for the feedback! I had considered both returning a tuple (key, &value)
and an Entry struct, but only returned the key since that's all Tyr currently
needs. I'll look at other Rust code to see which approach fits better, then
implement it properly in v2.
Best regards,
Alvin
This is all very troubling. I don't think Rust should depart from
what C has without good reason.