retrieve
mod x and use x::* pattern syntax sugar of the proc-macro attribute.
retrieve::mod_use=>mod x; use x::*;for a module internal.pub_mod_use=>pub mod x; use x::*for a public nested modules.mod_pub_use=>mod x; pub use x::*for a public flatten modules with separated source writting.pub_mod_pub_use=>pub x; pub use x::xfor a public nested modules with flatten alias in the root.
I am tired of writing the mod x; use x::*; pattern over and over again for structured beatiful source code!😝 And I like the stylish attribute proc-macro style syntax sugars.💖
Example: examples/
- src/
- main.rs
- x.rs ; Or it can move to x/mod.rs if you like module-name/mod.rs style.
- x/
- a.rs ;
crate::x::a::* - b.rs ;
crate::x::b::*
- a.rs ;
- main.rs:
use *;
// <-- here!; it's the same as `mod x; pub use x::*;`
- x.rs:
use *;
// <-- here!; it's the same as `mod a; pub use a::*;` and `mod b; pub use b::*;`
for Debuggin
retrieve has print feature. It will be show a part of evaluated syntax:
eg. Run the example with print feature:
Then, you will get something like it in the build messages:
)
)
; ;
)
{
)
; ;
; ;
; ;
)
; ;
;
)
LICENSE
Author
- USAGI.NETWORK / Usagi Ito https://github.com/usagi/