So I have a macro that needs to create code referencing another module of the crate
#[macro_export]
macro_rules! thing {
($e:expre) => {crate::thingy::doer()}
}
From inside the crate this works, but from outside it doesn't I need it to work both inside and out.
Any tips. Thanks
jer
2
Use $crate:
The keyword metavariable $crate can be used to refer to the current crate
via Macros By Example - The Rust Reference
For the sake of completeness, for people stumbling upon this when writing a procedural macro, let's also have a pointer to Proc macros - using third party crate - #4 by Yandros