fn start_simulator() {
    println!("Looking for iOS simulator");
    let output = t!(Command::new("xcrun").arg("simctl").arg("list").output());
    assert!(output.status.success());
    let mut simulator_exists = false;
    let mut simulator_booted = false;
    let mut found_rust_sim = false;
    let stdout = t!(String::from_utf8(output.stdout));
    for line in stdout.lines() {
        if line.contains("rust_ios") {
            if found_rust_sim {
                panic!("Duplicate rust_ios simulators found. Please \
                        double-check xcrun simctl list.");
            }
            simulator_exists = true;
            simulator_booted = line.contains("(Booted)");
            found_rust_sim = true;
        }
    }

    if simulator_exists == false {
        println!("Creating iOS simulator");
        Command::new("xcrun")
                .arg("simctl")
                .arg("create")
                .arg("rust_ios")
                .arg("com.apple.CoreSimulator.SimDeviceType.iPhone-SE")
                .arg("com.apple.CoreSimulator.SimRuntime.iOS-10-2")
                .check_status();
    } else if simulator_booted == true {
        println!("Shutting down already-booted simulator");
        Command::new("xcrun")
                .arg("simctl")
                .arg("shutdown")
                .arg("rust_ios")
                .check_status();
    }

    println!("Starting iOS simulator");
    // We can't uninstall the app (if present) as that will hang if the
    // simulator isn't completely booted; just erase the simulator instead.
    Command::new("xcrun").arg("simctl").arg("erase").arg("rust_ios").check_status();
    Command::new("xcrun").arg("simctl").arg("boot").arg("rust_ios").check_status();
}
// Step two: Start the iOS simulator
Step two: Start the iOS simulator
Step two : Start the iOS simulator
fn start_simulator() {
    println!("Looking for iOS simulator");
    let output = t!(Command::new("xcrun").arg("simctl").arg("list").output());
    assert!(output.status.success());
    let mut simulator_exists = false;
    let mut simulator_booted = false;
    let mut found_rust_sim = false;
    let stdout = t!(String::from_utf8(output.stdout));
    for line in stdout.lines() {
        if line.contains("rust_ios") {
            if found_rust_sim {
                panic!("Duplicate rust_ios simulators found. Please \
                        double-check xcrun simctl list.");
            }
            simulator_exists = true;
            simulator_booted = line.contains("(Booted)");
            found_rust_sim = true;
        }
    }
    if simulator_exists == false {
        println!("Creating iOS simulator");
        Command::new("xcrun")
                .arg("simctl")
                .arg("create")
                .arg("rust_ios")
                .arg("com.apple.CoreSimulator.SimDeviceType.iPhone-SE")
                .arg("com.apple.CoreSimulator.SimRuntime.iOS-10-2")
                .check_status();
    } else if simulator_booted == true {
        println!("Shutting down already-booted simulator");
        Command::new("xcrun")
                .arg("simctl")
                .arg("shutdown")
                .arg("rust_ios")
                .check_status();
    }
    println!("Starting iOS simulator");
    // We can't uninstall the app (if present) as that will hang if the
    // simulator isn't completely booted; just erase the simulator instead.
    Command::new("xcrun").arg("simctl").arg("erase").arg("rust_ios").check_status();
    Command::new("xcrun").arg("simctl").arg("boot").arg("rust_ios").check_status();
}
fn start_simulator ( ) { println ! ( " " ) ; let output = t ! ( Command new ( " " ) arg ( " " ) arg ( " " ) output ( ) ) ; assert ! ( output status success ( ) ) ; let mut simulator_exists = false ; let mut simulator_booted = false ; let mut found_rust_sim = false ; let stdout = t ! ( String from_utf8 ( output stdout ) ) ; for line in stdout . lines ( ) { if line . contains ( " " ) { if found_rust_sim { panic ! ( " \
 " ) ; } simulator_exists = true ; simulator_booted = line . contains ( " " ) ; found_rust_sim = true ; } } if simulator_exists == false { println ! ( " " ) ; Command :: new ( " " ) . arg ( " " ) . arg ( " " ) . arg ( " " ) . arg ( " " ) . arg ( " " ) . check_status ( ) ; } else if simulator_booted == true { println ! ( " " ) ; Command :: new ( " " ) . arg ( " " ) . arg ( " " ) . arg ( " " ) . check_status ( ) ; } println ! ( " " ) ; // We can't uninstall the app (if present) as that will hang if the // simulator isn't completely booted; just erase the simulator instead. Command :: new ( " " ) . arg ( " " ) . arg ( " " ) . arg ( " " ) . check_status ( ) ; Command :: new ( " " ) . arg ( " " ) . arg ( " " ) . arg ( " " ) . check_status ( ) ; }
Step two: Start the iOS simulator
Step two : Start the iOS simulator