On 10/16/2025 11:02 AM, Joel Fernandes wrote:
> From: Alexandre Courbot <[email protected]>
> 
> The getter method of a field works with the field type, but its setter
> expects the type of the register. This leads to an asymmetry in the
> From/Into implementations required for a field with a dedicated type.
> For instance, a field declared as
> 
>     pub struct ControlReg(u32) {
>         3:0 mode as u8 ?=> Mode;
>         ...
>     }
> 
> currently requires the following implementations:
> 
>     impl TryFrom<u8> for Mode {
>       ...
>     }
> 
>     impl From<Mode> for u32 {
>       ...
>     }
> 
> Change this so the `From<Mode>` now needs to be implemented for `u8`,
> i.e. the primitive type of the field. This is more consistent, and will
> become a requirement once we start using the TryFrom/Into derive macros
> to implement these automatically.
> 
> Reviewed-by: Joel Fernandes <[email protected]>
> Signed-off-by: Alexandre Courbot <[email protected]>

Uff, my SOB is missing.

Signed-off-by: Joel Fernandes <[email protected]>

Alex, do you mind adding it to the patch when applying?

thanks,

 - Joel

Reply via email to