Re: [PATCH v2 4/5] rust: io: add `register!` macro

From: Alexandre Courbot

Date: Mon Jan 26 2026 - 01:57:50 EST


On Mon Jan 26, 2026 at 12:24 PM JST, Alexandre Courbot wrote:
>> Another top-level question I have is whether we should define multiple registers
>> (perhaps all) in one macro invocation. That's the strategy of `tock-registers`
>> crate which is widely used in embedded Rust.
>
> I agree that would be nice, especially as it opens the way for better
> syntax for e.g. register blocks with a base.
>
> I am having trouble adding that to the current design though. Some rules
> use the tt muncher pattern and these will greedily consume all tokens,
> including those for the next register. I am a bit at my wit's end here,
> but if you have an idea for how to do it nicely then by all means. :)

Actually I found a way to do it. V3 will support multiple register
definitions per invocation, thanks for the suggestion!