ratatui / ratatui-macros

Macros for simplifying boilerplate for creating UI using Ratatui.
https://ratatui.rs
MIT License
28 stars 2 forks source link

Simplify implementation of `constraints!` macro #1

Closed deifactor closed 10 months ago

deifactor commented 10 months ago

The new implementation is simpler in terms of rules and moves parsing individual constraints into a separate macro at the expense of slower compile times (since it only processes one token at a time). IMO this is worth it.

The output is also now an array literal rather than an iterator chain.

kdheepak commented 10 months ago

I just wrapped my head around the implementation of the macro! Super cool! Including a , at the end is a neat way to do this.

Thank you so much for the PR!

kdheepak commented 10 months ago

I think some of the compiler error messages can be improved but I'm not able to figure out how to do it without breaking everything. I'd also like to get an optional , comma working at some point. But for now, this looks good to me and I'm going to go ahead and merge it.

Thanks again for the PR!