fn print_snapshot_data_format(snapshot_path: &str) {
    let mut snapshot_reader = File::open(snapshot_path).unwrap_or_else(|err| {
        process::exit(generic_error_exit(&format!(
            "Unable to open snapshot state file: {:?}",
            err
        )));
    });
    let data_format_version = Snapshot::get_data_version(&mut snapshot_reader, &VERSION_MAP)
        .unwrap_or_else(|err| {
            process::exit(generic_error_exit(&format!(
                "Invalid data format version of snapshot file: {:?}",
                err
            )));
        });

    let (key, _) = FC_VERSION_TO_SNAP_VERSION
        .iter()
        .find(|(_, &val)| val == data_format_version)
        .unwrap_or_else(|| {
            process::exit(generic_error_exit(&format!(
                "Cannot translate snapshot data version {} to Firecracker microVM version",
                data_format_version
            )));
        });
    println!("v{}", key);
}
// Print data format of provided snapshot state file.
Print data format of provided snapshot state file.
Print data format of provided snapshot state file .
fn print_snapshot_data_format(snapshot_path: &str) {
    let mut snapshot_reader = File::open(snapshot_path).unwrap_or_else(|err| {
        process::exit(generic_error_exit(&format!(
            "Unable to open snapshot state file: {:?}",
            err
        )));
    });
    let data_format_version = Snapshot::get_data_version(&mut snapshot_reader, &VERSION_MAP)
        .unwrap_or_else(|err| {
            process::exit(generic_error_exit(&format!(
                "Invalid data format version of snapshot file: {:?}",
                err
            )));
        });
    let (key, _) = FC_VERSION_TO_SNAP_VERSION
        .iter()
        .find(|(_, &val)| val == data_format_version)
        .unwrap_or_else(|| {
            process::exit(generic_error_exit(&format!(
                "Cannot translate snapshot data version {} to Firecracker microVM version",
                data_format_version
            )));
        });
    println!("v{}", key);
}
fn print_snapshot_data_format ( snapshot_path : & str ) { let mut snapshot_reader = File :: open ( snapshot_path ) . unwrap_or_else ( | err | { process :: exit ( generic_error_exit ( & format ! ( " " err ) ) ) ; } ) ; let data_format_version = Snapshot :: get_data_version ( & mut snapshot_reader , & VERSION_MAP ) . unwrap_or_else ( | err | { process :: exit ( generic_error_exit ( & format ! ( " " err ) ) ) ; } ) ; let ( key , _ ) = FC_VERSION_TO_SNAP_VERSION . iter ( ) . find ( | ( _ , & val ) | val == data_format_version ) . unwrap_or_else ( | | { process :: exit ( generic_error_exit ( & format ! ( " " data_format_version ) ) ) ; } ) ; println ! ( " " key ) ; }
Print data format of provided snapshot state file.
Print data format of provided snapshot state file .
snapshot_path
&str
snapshot_path
&str