Support items generated by proc macros
See original GitHub issueFor example, let’s say I am using the crate derive_builder
with the following code snippet:
#[derive(Clone, Debug, Builder)]
pub struct MyStruct {
foo: String
}
derive_builder
generates a new struct named MyStructBuilder
. I’d like to have this generated MyStructBuilder
struct available as an autocomplete option to make its usage easier.
Issue Analytics
- State:
- Created 6 years ago
- Reactions:112
- Comments:41 (16 by maintainers)
Top Results From Across the Web
Procedural Macros - The Rust Reference
Attribute macros define new outer attributes which can be attached to items, including items in extern blocks, inherent and trait implementations, and trait ......
Read more >Support items generated by proc macros -
For example, let's say I am using the crate derive_builder with the following code snippet: #[derive(Clone, Debug, Builder)] pub struct MyStruct { foo: ......
Read more >Procedural macros in Rust
Procedural macros allow you to generate Rust code at compile time. This guide covers everything you need to know about proc macros in...
Read more >Procedural macros under the hood: Part I | The IntelliJ Rust ...
They allow you to expand the language syntax with custom constructs. They help you reduce the amount of boilerplate code. How macros generate...
Read more >Guide to Rust procedural macros | developerlife.com
This will replace whatever `item` is // annotated w/ this attribute proc macro. // 3. Return the generated tokens. input } ...
Read more >Top Related Medium Post
No results found
Top Related StackOverflow Question
No results found
Troubleshoot Live Code
Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start FreeTop Related Reddit Thread
No results found
Top Related Hackernoon Post
No results found
Top Related Tweet
No results found
Top Related Dev.to Post
No results found
Top Related Hashnode Post
No results found
Top GitHub Comments
I probably should’ve checked if you’re okay with my doing this, but I’ve created a bounty for this issue on BountySource to encourage contributions.
When I was a beginner Rustacean, 12 months ago, I was intrigued by the possibility to leave memory hogs such as Spring/Java and replace them with seemingly nice alternatives like Rocket/Diesel.
At that stage I found Rocket’s documentation to be very good, and Diesel’s getting started guide was at least good enough to get started. At least in combination with some random blog posts.
Then I started to flesh out my app with more and more SQL tables, and frankly I hit a brick wall.
At that stage, I was desperately seeking information on how to do really basic things with Diesel, but the Diesel web page only covers the super basic things, and the crate documentation is literally impenetrable it’s just pages of traits and generic parameters. I still can’t write a good generic function to do things that are really easy to understand using e.g. jOOQ in Java, but that’s besides the point.
It would have saved me a lot of time to have that autocomplete available for things that Diesel generated in procedural macros.
I finally figured most of the things out by combining information from blogs, stackoverflow, and random github issues.
If I didn’t really really like rust (which I do!) I probably would have just given up.
TL;DR For beginner/intermediate Rustaceans procedural macro autocomplete is really important. As your understanding of the language and tooling (and
cargo expand
) grows, it becomes less important.That’s why I personally think it would be a great investment to have in intellij-rust. But I also understand that it’s complicated and hard to implement.