mods!
Simpler module declaration, brought to you by @NikolaiVazquez!
This library enables you to declare modules in ways the current syntax doesn't allow.
Examples
To declare multiple public modules, simply place pub
before a module list:
!
mods
This works for all visibility modifiers:
!
mods
Without the mods!
macro, the same code is much less succinct. This is what the
macro expands out to:
pub
pub
pub
pub
Installation
This crate is available on crates.io and can be used by adding the
following to your project's Cargo.toml
:
[]
= "1.0.0"
Minimum Supported Rust Version (MSRV)
This library requires Rust 1.9.0 as the minimum version and will work with all subsequent versions.
This is because previous versions can't have mod x;
declarations within
submodules When testing this we
get an error complaining that the module file is not inside the directory "src".
Rust 2015
If you're not using Rust 2018, add this to your crate root (main.rs
or
lib.rs
):
extern crate mods;
You can then use the macro directly from anywhere:
mods!
Wishful Thinking
It would be wonderful if we could instead have:
Or a syntax that matches use
imports:
pub mod ;
Changes
See CHANGELOG.md
for an exhaustive list of what has changed from one version
to another.
License
This project is released under either: