Re: [PATCH v2 2/3] rust: clist: Add basic list infrastructure and head iterator

From: Joel Fernandes

Date: Tue Nov 25 2025 - 18:06:56 EST




On 11/23/2025 10:47 PM, Alexandre Courbot wrote:
>> +}
>> +
>> +/// Low-level iterator over `list_head` nodes.
>> +///
>> +/// An iterator used to iterate over a C intrusive linked list (`list_head`). Caller has to
>> +/// perform conversion of returned `ClistHead` to an item (typically using `container_of` macro).
>> +///
>> +/// # Invariants
>> +///
>> +/// `ClistHeadIter` is iterating over an allocated, initialized and valid `Clist`.
>> +pub struct ClistHeadIter<'a> {
>> + current: &'a ClistHead,
>> + head: &'a ClistHead,
>
> IIUC `head` should probably be a `Clist`?

Sure, but then I would rename it from 'head' to 'list' then, if that's Ok.

The iterator holds the list, and the current position, which makes sense to me.

thanks,

- Joel

- Joel