Hiding private implementation details for a proc macro

⚓ Rust    📅 2026-05-28    👤 surdeus    👁️ 4      

surdeus

Hi all,
I'm working on bindings to a C plugin API that requires exposing some unsafe code in a user's code for bootstrapping and declaring plugins. My plan is to do all this through a proc macro that automatically generates the correct implementation of this code, but doing this means exposing internal plumbing that I would really rather not expose outside of the macro invocation.

I know there is an option to use a lot of #[doc(hidden)] and to prefix things with multiple underscores, but is there a way to only export crate items/modules for use in macros in a way that the compiler would otherwise object to?

1 post - 1 participant

Read full topic

🏷️ Rust_feed