Iterator over a Vec of tuples, partially mutable

Hi all.

I'm trying to write an iterator that yields references to sequence of tuples where only one field of the tuple is mutable.

struct Thing<A, B, C> {
    content: Vec<(A, B, C)>

What I want is essentially to write a method for Thing that returns an Iterator over content whose Item is something like &(&A, &B, &mut C). The caller can use read-only the first and the second field of the tuple and then modify, in-place inside the vector, the third field of each tuple yielded.

I hope I explained myself :slight_smile:

Is it feasable? Or... I'd better do something else?

Thanks for any suggestion.


1 Like

Lightining fast! I learned something. Thanks a lot!