Re: [PATCH v8 07/10] rust: io: introduce `IntoIoVal` trait and single-argument `write_val`
From: Alexandre Courbot
Date: Wed Mar 11 2026 - 09:46:03 EST
On Wed Mar 11, 2026 at 10:25 PM JST, Danilo Krummrich wrote:
<snip>
> IIUC, the return value could be a generic tuple struct with <L: IoLoc<T>, V:
> IntoIoVal<T, L>> that dereferences to V?
>
> I.e. the current write_val() already allows this:
>
> bar.write_val((WithBase::of::<E>(), reg))
>
> so, a corresponding read_val() - both write_val() and read_val() should really
> have different names - could return the same thing, just as a generic type that
> dereferences to self.1.
>
> With this you could do
>
> let reg = bar.read_reg(regs::NV_PFALCON_FALCON_RM::of::<E>());
>
> reg.modify();
That's the tricky part - the register methods don't modify in-place,
they return a new value. I don't see how we could avoid a closure (and
mutable variables) here.