0

Let's say I have following folder structure:

src
├── lib.rs
└── models
   ├── gate.rs
   ├── load_balancer.rs
   ├── mod.rs
   ├── processor.rs
   └── storage.rs

Inside models/mod.rs I want to import everything that sits in same directory, however, it is important to me that when a new file in directory models is created, I won't have to update or change in any way the mod.rs file.

In other words, I'd like to write such macro:

// mod.rs
import_everything_in_module!()

which would expand to this:

// mod.rs
mod gate;
mod load_balancer;
mod processor;
mod storage;

Is that possible? If not, why?

Marcin
  • 179
  • 2
  • 14

0 Answers0