I'm trying to make a global, compile time static identifier counter. I just want a (semi) continuous list set of values that i can assign to a const. But ideally not manually managed. in Rust, any ideas?
-
Show this thread
-
Right now i had to settle for a file!() line!() tuple but now i need hashmaps to look them up. A vector is MUCH preferred. Any ideas?
2 replies 0 retweets 0 likesShow this thread -
Its kinda funny that something like 'allocating an ID at compiletime' is such an extremely difficult concept.
1 reply 0 retweets 0 likesShow this thread -
Replying to @rikarends
moxie has a couple of approaches for this. The most clever is that you can use a macro to define a new type, then get a statically unique integer from any::TypeId().
2 replies 1 retweet 4 likes
Replying to @raphlinus @rikarends
I think it's moving to "implicit caller location" (see Rust RFC 2091), but this is not yet stable and might be considered deep magic.
3:13 PM - 18 Nov 2019
0 replies
0 retweets
0 likes
Loading seems to be taking a while.
Twitter may be over capacity or experiencing a momentary hiccup. Try again or visit Twitter Status for more information.