This commit is contained in:
nap.liu
2023-12-11 18:40:53 +08:00
parent d1b95f1096
commit 5dc4708fe2
79 changed files with 2269 additions and 39 deletions

View File

@@ -0,0 +1,14 @@
//! cfg 还支持自定义属性值
//! 通过 `rustc --cfg custom` 传递额外的值
//!
// 这个属性就是外部传递的
// rustc --cfg some_condition custom.rs && ./custom
#[cfg(some_condition)]
fn conditional_function() {
println!("condition met!");
}
fn main() {
conditional_function();
}