I’m writing an app that lets you make osx Dock applets from Rust. I have defined a macro in a library that abstracts a bunch of objective-c boilerplate setup. The macro works, but when I use it, all the various objective-c types it uses get “pulled in” to the call site, which means that site needs to import many of the same modules or else it fails to compile.
So I have this as the call site:
Which requires a bunch of objective c imports in that file, so that the macro, defined here, compiles.
(Note I couldn’t include a preview link because, as a new user, I have a 2 link quota)
It makes sense to me why this would occur, since its just expanding the macro at the call site. Is there a way to prevent it? It seems like I might be able to use $crate in the macro definition in some way, but so far my efforts have failed. I have studied the Book and serde (which uses a lot of macros) but haven’t seen an example of how to resolve this.