【发布时间】:2019-03-01 23:13:51
【问题描述】:
在 Rust 中,我有时会在 extern crate 语句之前看到 #[macro_use]:
#[macro_use]
extern crate gotham_derive;
与没有#[macro_use]相比,这有什么作用?
extern crate gotham_derive;
【问题讨论】:
-
我对 Rust 的宏不是很熟悉,但 it appears 在 Rust 2015 中需要
#[macro_use]来通知编译器您正在使用 crate 中定义的宏。
标签: rust rust-macros