3 ms·
> routing and parameters are relying on magic # annotations Actually, as someone almost finished with the book, that brings up an interesting point. What cont
by kbenson 9y ago
> routing and parameters are relying on magic # annotations
Actually, as someone almost finished with the book, that brings up an interesting point. What controls # annotations and how do you hook into them (which also answers the question of how magic they are)?
If it's fairly standard and obvious how to look up, I think I might not classify them as much "magic", but truthfully, I have no idea at all. Maybe I'm just not remembering that part of the book (I did take a break for a month), or maybe I didn't make a connection that was implied?
- jrhurst 9y agoLook into macros 1.1 to see how they're use for `#derived` they're not particularly super magical. Though unstable stuff rocket uses is a bit more magical.
- steveklabnik 9y agoRight now, those annotations (attributes in Rust parlance) are only made available by the compiler, but this year, the feature Rocket uses to define your own will be stable. You write a function that takes the code as input and produces code as output, to put it in the simplest of terms.