Check out example codes for "how to check for os in rust". It will help you in understanding the concepts better.

Code Example 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)]

Learn ReactJs, React Native from akashmittal.com