For the Rustaceans out there, a question: I have a set of complex routines all parameterized by a const value L (the 'branching factor' of the curve tree), and that L is used to size various arrays etc. So it's specified as a const generic. Now I want the user to set this value in a config file, because depending on how many pubkeys they're processing, different L values will be appropriate. Now, to be clear, only a few possible powers of 2 are probably ever needed for L (even as few as 3; 256,512,1024 probably covers most practical scenarios, though more values would be nice), but of course, setting it in a config is incompatible with compile-time specification, as a const. What's the most sensible solution? Writing multiple versions of the calling function so the config var can choose which one to run? If so, how to do that most cleanly (macros? how?), or if not, what is another smarter way to do it?
Discussion
Use a procedural macro that reads the config value and generates the const L using the value specified before compilation.
Ah thanks, I wasn't entirely sure from a brief read whether proc macros could do it or not, I will research it more, thanks.