Check out example codes for "check if a file exists rust". It will help you in understanding the concepts better.

Code Example 1

use std::path::Path;

fn main() {
    println!("{}", Path::new("/etc/hosts").exists());
}

Learn ReactJs, React Native from akashmittal.com