Rust's procedural macros can be one of the more complicated and difficult to read sections of any codebase. A well-implemented and easy to use macro greatly improves a codebase by removing boilerplate code and user-facing complexity. My goal for the internship is to make the
ruma macro crates readable and easy for newcomers to follow and add to. This will allow easier debugging and enable more people to review pull requests in the code-gen heavy crates. I plan to implement macro testing using trybuild or macrotest for both
ruma-api. I will improve the error messages of the
ruma-events by using relevant spans and crafting helpful suggestions or examples to emit to the compiler, so the user knows exactly where and how to fix their code.
The other goal of the project is to implement new code generation macros for the next breaking release version of
ruma-events. The release will contain a major rewrite of how the event types are structured themselves and within collections. I will work on generating code for the new collection types and adapt existing code generation to the new API.