📜  如何在 rust 代码示例中检查操作系统

📅  最后修改于: 2022-03-11 14:49:25.639000             🧑  作者: Mango

代码示例1
// rust programming language
if cfg!(windows) {
    println!("this is windows");
} else if cfg!(unix) {
    println!("this is unix alike");
}

//you can also use #[cfg(target_os="my_os")] or just #[cfg(my_os)]