Have you ever made a Rust program which generates Rust code?

82 points krydx

I had to do it recently and I liked it.

Well, not as much 'had to', as it was the easiest option to get around some compile time checks. Basically I needed a const array to compile my main program, but I couldn't determine its length or data without some prior calculations.

Have you ever done something like that and if so, for what purpose?