Why Nostr? What is Njump?
2024-03-29 17:05:08

waxwing on Nostr: For the Rustaceans out there, a question: I have a set of complex routines all ...

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?
Author Public Key
npub1vadcfln4ugt2h9ruwsuwu5vu5am4xaka7pw6m7axy79aqyhp6u5q9knuu7