I'm creating some helper functions/enums for a derive macro. I annotate many structs/enums with this derive macro. But for each annotation I end up generating duplicates of those helpers. How do I limit certain code generation to once?
Almost all proc macro libraries come as two crates: one that provides runtime support facilities and another that implements the compile-time code generation. Usually, the runtime crate will list the compile-time crate as a dependency and re-export the proc macro. This lets downstream users have access to the entire library by including only the runtime crate in Cargo.toml.