autoexport 0.1.0

Automatically use all the modules laid out in a top-level mod
Documentation
  • Coverage
  • 50%
    1 out of 2 items documented0 out of 1 items with examples
  • Size
  • Source code size: 6.47 kB This is the summed size of all the files inside the crates.io package for this release.
  • Documentation size: 276.04 kB This is the summed size of all files generated by rustdoc for all configured targets
  • Ø build duration
  • this release: 7s Average build duration of successful builds.
  • all releases: 7s Average build duration of successful builds in releases after 2024-10-23.
  • Links
  • crates.io
  • Dependencies
  • Versions
  • Owners
  • jkelleyrtp

Autoexport

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.

Usage

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

#[autoexport::autoexport]
pub mod components {
    pub mod footer;
    pub mod header;
}

// now all of footer/header are in scope

run_function_thats_defined_in_footer();

run_function_thats_defined_in_header();

License

MIT or Apache at your discretion