1

I'm having some trouble trying to scope a macro.

I have my library abc with lib.rs that contains only:

pub mod example;

and then in example.rs at the same level as lib.rs:

#[macro_export]
macro_rules! my_example {
    () => {
        no.arg.passed(None)
    };

    ($x:expr) => {
        arg.passed(Some($x))
    };
}

I want the my_example! macro to be only accessible through abc::example::my_example!, however the above code seems to result in it being only accessible through abc::my_example!.

I think I may be misunderstanding the #[macro_export]'s effect. Any suggestions on how to achieve the module-scoped macro?

dudebro
  • 112
  • 6

0 Answers0