#[cfg(...)] Attribute Rustã§ã¯ #[cfg(...)] ã¢ããªãã¥ã¼ãã使ããã¨ã«ãã£ã¦ãOSãCPUã«å¿ããæ¡ä»¶ã³ã³ãã¤ã«ãè¡ããã¨ãã§ããã Conditional Compilation cfgã¯è¤æ°æ¡ä»¶æå®å¯è½ï¼OR, AND, NOTï¼ #[cfg(any(unix, windows))] #[cfg(all(unix, target_pointer_width = "32"))] #[cfg(not(foo))] Attributes - The Rust Reference ä¾ãã°ã次ã®ããã«æ¸ããã¨ã§ã³ã³ãã¤ã«ã¿ã¼ã²ããã®OSã«å¿ããhello()ããã«ãããå¼ã³åºããã¨ãã§ããã #[cfg(target_os = "windows")] fn hello() { println!("Hello, I'm Windows!"); } #[cfg(
{{#tags}}- {{label}}
{{/tags}}