2

Is it possible to use a macro that lives in the mod.rs file in the same directory without the use directive?

My project structure is as follows:

src
 |-- ui
      |-- mod.rs
      |-- alarm.rs

Now in mod.rs I have

#[macro_export]
macro_rules! pack {
    ($container:expr, $widget:expr, $expand:expr) => {
        $container.pack_start($widget, $expand, true, crate::consts::DIALOG_BOX_SPACING_U32)
    };
}

But in alarm.rs I cannot access this macro using super::pack!(). How can I access a macro defined in mod.rs? For reference, I can access functions using super::a_pub_fn(arg) way with no issues.

pretzelhammer
  • 13,874
  • 15
  • 47
  • 98
noconst
  • 639
  • 4
  • 15

0 Answers0