Custom `derive` macro without the actual `Trait` to be derived [closed]
Closed 13 days ago.
Macro error: expected one of: `struct`, `enum`, `union`
I am trying to create an attribute proc macro which takes field_name = field_type
like so
what is the syn type/struct that represents the nested field offset parameter to offset_of! macro?
If I want to wrap a macro around offset_of!
‘s nested form, e.g. offset_of!(Foo, x.y.VariantA.0)
, what should x.y.VariantA.0
get parsed as in syn terms (e.g. which of these https://docs.rs/syn/latest/syn/index.html#structs)?
How to interpolate a type name as a string literal inside an invocation of the quote macro (from the quote crate)?
I’m trying to write a proc_macro that automatically implement a trait for a struct. The trait is as follows
How to escape the quote mark in the rust quote macro from the quote crate?
I’m trying to write a proc_macro that automatically implement a trait for a struct. The trait is as follows
How to loop within quote::quote
Problem Description and Proof of Concept In my attempts of learning new concepts in programming, I usually like to re-implement something which has already been done. In this case I’m trying to learn Rust procedual macros by implementing a csv-like parser. However I ran into some problems. Assuming a struct struct MyStruct { _first_field: String, […]
How to loop within a proc_macro in Rust
Problem Description and Proof of Concept In my attempts of learning new concepts in programming, I usually like to re-implement something which has already been done. In this case I’m trying to learn Rust procedual macros by implementing a csv-like parser. However I ran into some problems. Assuming a struct struct MyStruct { _first_field: String, […]