fn load_or_create_a2l<'a>(arg_matches: &'a ArgMatches<'a>, strict: bool, verbose: u64, now: Instant) -> Result<(&'a std::ffi::OsStr, a2lfile::A2lFile), String> {
    if let Some(input_filename) = arg_matches.value_of_os("INPUT")
    {
        let mut log_msgs = Vec::<String>::new();
        let a2lresult = a2lfile::load(input_filename, Some(ifdata::A2MLVECTOR_TEXT.to_string()), &mut log_msgs, strict);
        for msg in log_msgs {
            cond_print!(verbose, now, msg);
        }
        let a2l_file = a2lresult?;
        cond_print!(verbose, now, format!("Input \"{}\" loaded", input_filename.to_string_lossy()));
        Ok((input_filename, a2l_file))
    } else if arg_matches.is_present("CREATE") {
        // dummy file name
        let input_filename = OsStr::new("<newly created>");
        // a minimal a2l file needs only a PROJECT containing a MODULE
        let mut project = a2lfile::Project::new("new_project".to_string(), "description of project".to_string());
        project.module = vec![a2lfile::Module::new("new_module".to_string(), "".to_string())];
        let mut a2l_file = a2lfile::A2lFile::new(project);
        // also set ASAP2_VERSION 1.71
        a2l_file.asap2_version = Some(a2lfile::Asap2Version::new(1, 71));
        Ok((input_filename, a2l_file))
    } else {
        // shouldn't be able to get here, the clap config requires either INPUT or CREATE
        Err("impossible: no input filename and no --create".to_string())
    }
}
// load or create an a2l file, depending on the command line
// return the file name (a dummy value if it is created) as well as the a2l data
load or create an a2l file, depending on the command line
return the file name (a dummy value if it is created) as well as the a2l data
load or create an a2l file depending on the command line return the file name ( a dummy value if it is created ) as well as the a2l data
fn load_or_create_a2l<'a>(arg_matches: &'a ArgMatches<'a>, strict: bool, verbose: u64, now: Instant) -> Result<(&'a std::ffi::OsStr, a2lfile::A2lFile), String> {
    if let Some(input_filename) = arg_matches.value_of_os("INPUT")
    {
        let mut log_msgs = Vec::<String>::new();
        let a2lresult = a2lfile::load(input_filename, Some(ifdata::A2MLVECTOR_TEXT.to_string()), &mut log_msgs, strict);
        for msg in log_msgs {
            cond_print!(verbose, now, msg);
        }
        let a2l_file = a2lresult?;
        cond_print!(verbose, now, format!("Input \"{}\" loaded", input_filename.to_string_lossy()));
        Ok((input_filename, a2l_file))
    } else if arg_matches.is_present("CREATE") {
        // dummy file name
        let input_filename = OsStr::new("<newly created>");
        // a minimal a2l file needs only a PROJECT containing a MODULE
        let mut project = a2lfile::Project::new("new_project".to_string(), "description of project".to_string());
        project.module = vec![a2lfile::Module::new("new_module".to_string(), "".to_string())];
        let mut a2l_file = a2lfile::A2lFile::new(project);
        // also set ASAP2_VERSION 1.71
        a2l_file.asap2_version = Some(a2lfile::Asap2Version::new(1, 71));
        Ok((input_filename, a2l_file))
    } else {
        // shouldn't be able to get here, the clap config requires either INPUT or CREATE
        Err("impossible: no input filename and no --create".to_string())
    }
}
fn load_or_create_a2l < ' a > ( arg_matches : & ' a ArgMatches < ' a > , strict : bool , verbose : u64 , now : Instant ) -> Result < ( & ' a std :: ffi :: OsStr , a2lfile :: A2lFile ) , String > { if let Some ( input_filename ) = arg_matches . value_of_os ( " " ) { let mut log_msgs = Vec :: < String > :: new ( ) ; let a2lresult = a2lfile :: load ( input_filename , Some ( ifdata :: A2MLVECTOR_TEXT . to_string ( ) ) , & mut log_msgs , strict ) ; for msg in log_msgs { cond_print ! ( verbose now msg ) ; } let a2l_file = a2lresult ? ; cond_print ! ( verbose now format ( " \" \" " input_filename to_string_lossy ( ) ) ) ; Ok ( ( input_filename , a2l_file ) ) } else if arg_matches . is_present ( " " ) { // dummy file name let input_filename = OsStr :: new ( " " ) ; // a minimal a2l file needs only a PROJECT containing a MODULE let mut project = a2lfile :: Project :: new ( " " . to_string ( ) , " " . to_string ( ) ) ; project . module = vec ! [ a2lfile Module new ( " " to_string ( ) " " to_string ( ) ) ] ; let mut a2l_file = a2lfile :: A2lFile :: new ( project ) ; // also set ASAP2_VERSION 1.71 a2l_file . asap2_version = Some ( a2lfile :: Asap2Version :: new ( 1 , 71 ) ) ; Ok ( ( input_filename , a2l_file ) ) } else { // shouldn't be able to get here, the clap config requires either INPUT or CREATE Err ( " " . to_string ( ) ) } }
load or create an a2l file, depending on the command line
return the file name (a dummy value if it is created) as well as the a2l data
load or create an a2l file depending on the command line return the file name ( a dummy value if it is created ) as well as the a2l data
arg_matches
&'a ArgMatches<'a>
strict
bool
verbose
u64
now
Instant