I'm experimenting with Rust Edition 2018. In Rust 2015 you use
#[macro_use]
extern crate log;
for importing macros. In Rust 2018 extern crate
is probably unidiomatic. Is there a way, to import all macros from the crate without extern crate
? For simple macros, importing it in the modules is fine, but complicated macros depend on several other macros, which is unhandy.
As you already stated you can import a single macro via
To import multiple macros at once you can either use nested imports
or rely on the crate author that they will let you import it via a single glob, e.g.
I don't see any way of importing only all the macros, but if you are fine with importing all the essential objects a crate provides, you should usually get all the macros by writing:
or
This also works in Rust 2015 starting in version 1.30.