我正在尝试使用Rust Edition 2018.在Rust 2015中你使用
#[macro_use]
extern crate log;
Run Code Online (Sandbox Code Playgroud)
用于导入宏.在Rust 2018 extern crate中可能是单一的.有没有办法,从箱子里导入所有的宏extern crate?对于简单的宏,在模块中导入它很好,但复杂的宏依赖于其他几个宏,这是不方便的.
我没有看到进口的任何方式只有所有宏,但如果你是罚款所有进口一箱提供了必要的对象,你应该平时获得通过书面的所有宏:
use the_crate_with_macros::*;
Run Code Online (Sandbox Code Playgroud)
要么
use the_crate_with_macros::prelude::*; // if available
Run Code Online (Sandbox Code Playgroud)
这也适用于从版本1.30开始的Rust 2015.