Compile-time values as parameters in functions in Rust?
Does Rust have something similar to C++ templates, in the way that they could create compile-time functions and accept compile-time values as template arguments?
Take this trival Rust function:
I could do this in C++:
Values aren't allowed as generic traits,
Is there a way to do something like this in Rust?
Hi, sorry, I know this is 6 months old, but I've just realised that this should be possible. Example:
This type of generic also works for
impl blocks, etc.
I somehow literally just found this whilst looking through the standard library.