#[cfg(foo)]
     #[cfg(bar = "baz")]     #[cfg(any(unix, windows))]
     #[cfg(all(unix, target_pointer_width = "32"))]
     #[cfg(not(foo))]#[cfg(any(not(unix), all(target_os="macos", target_arch = "powerpc")))]
     [features]
     # no features by default
     default = []
     # The “secure-password” feature depends on the bcrypt package.
     secure-password = ["bcrypt"]     --cfg feature="${feature_name}"     #[cfg(feature = "foo")]
     mod foo {
     }
#[cfg_attr(a, b)]
     if cfg!(target_os = "macos") || cfg!(target_os = "ios") {
         println!("Think Different!");
     }原文:http://blog.csdn.net/ucan23/article/details/45716247