#export #mod #macro-derive #derive #macro #use

macro autoexport

Automatically use all the modules laid out in a top-level mod

1 unstable release

0.1.0 Dec 25, 2022

#8 in #use




Automatically export a series of modules from a top-level module.

The modules must be defined within the body of the macro - autoexport does not know about modules inside files. This means you need to define your module structure from a top-level file, like lib.rs.

Rust's module system can be verbose at times, especially for large apps. This helps make your programs cleaner.


It's common to define a series of routes, components, or useful utilities in a top-level lib.rs that you want exported to other parts of your app. Just take on #[autoexport::autoexport] and voila, no need to write pub use item::*;

Autoexport will use the visibility defined at the site of the module

pub mod components {
    pub mod footer;
    pub mod header;

// now all of footer/header are in scope




MIT or Apache at your discretion


~35K SLoC