On 30/03/2014 10:30, Vladimir Pouzanov wrote:
That shifts the issue even more into runtime, doesn't it?
My goal is to find a way to resolve a tuple of (u8, u8, FuncNameEnum) to
u8, where FuncNameEnum is a long enum of all possible functions. And I
need to do that in compile time.
One way I see that is to make a really long list of enums like:
PORT0_PIN0_GPIO,
PORT0_PIN0_RD1,
...
for all possible port/pin/function combinations, then I can make a macro
to match on that to port/pin/fun u8 (that are actually used to configure
registers). The only thing is that I'd like to pass port and pin in as
u8 values, that makes it much more readable.
Well... Maybe it's time to do some big macro for matching all the stuff
and hope that compiler will optimise it anyway.
I’m sorry, it looks like I completely misunderstood your original
message. But then it’s still not clear to me what you’re trying to do.
Could you explain in more details, with more context? For example, what
is it you call a "function"? It seems not to be Rust function declared
with the `fn` keyword.
--
Simon Sapin
_______________________________________________
Rust-dev mailing list
Rust-dev@mozilla.org
https://mail.mozilla.org/listinfo/rust-dev