Re: [PATCH 03/10] rust: xarray: add `contains_index` method

From: Andreas Hindborg

Date: Wed Jan 07 2026 - 13:34:31 EST


Tamir Duberstein <tamird@xxxxxxxxx> writes:

> On Wed, Dec 3, 2025 at 5:27 PM Andreas Hindborg <a.hindborg@xxxxxxxxxx> wrote:
>>
>> Add a convenience method `contains_index` to check whether an element
>> exists at a given index in the XArray. This method provides a more
>> ergonomic API compared to calling `get` and checking for `Some`.
>
> It isn't clear when you'd want this API, and neither this nor the
> example are particularly motivating.

I added this when I had a line reading `if xa.get(index).is_none()
{...}`. I think it reads better as `if !xa.contains_index(index) {...}`.

Do you have an idea of how to improve the motivational factor of the
example? Writing motivating examples is not my top skill.


Best regards,
Andreas Hindborg