fn toml_to_args(tomldata: &str) -> Result<Vec<OsString>> {
    let config = tomldata.parse::<Value>()?;
    // To make testing easier, our function contract is to produce a stable ordering of flags for a given input.
    // Consequently, we use BTreeMap instead of HashMap here.
    let mut map: BTreeMap<String, Value> = BTreeMap::new();
    let tables = ["workspace.metadata.kani.flags", "package.metadata.kani.flags", "kani.flags"];

    for table in tables {
        if let Some(val) = get_table(&config, table) {
            map.extend(val.iter().map(|(x, y)| (x.to_owned(), y.to_owned())));
        }
    }

    let mut args = Vec::new();
    let mut suffixed_args = Vec::new();

    for (flag, value) in map {
        if flag == "cbmc-args" {
            // --cbmc-args has to come last because it eats all remaining arguments
            insert_arg_from_toml(&flag, &value, &mut suffixed_args)?;
        } else {
            insert_arg_from_toml(&flag, &value, &mut args)?;
        }
    }

    args.extend(suffixed_args);

    Ok(args)
}
/// Parse a config toml string and extract the cargo-kani arguments we should try injecting
Parse a config toml string and extract the cargo-kani arguments we should try injecting
Parse a config toml string and extract the cargo - kani arguments we should try injecting
fn toml_to_args(tomldata: &str) -> Result<Vec<OsString>> {
    let config = tomldata.parse::<Value>()?;
    // To make testing easier, our function contract is to produce a stable ordering of flags for a given input.
    // Consequently, we use BTreeMap instead of HashMap here.
    let mut map: BTreeMap<String, Value> = BTreeMap::new();
    let tables = ["workspace.metadata.kani.flags", "package.metadata.kani.flags", "kani.flags"];
    for table in tables {
        if let Some(val) = get_table(&config, table) {
            map.extend(val.iter().map(|(x, y)| (x.to_owned(), y.to_owned())));
        }
    }
    let mut args = Vec::new();
    let mut suffixed_args = Vec::new();
    for (flag, value) in map {
        if flag == "cbmc-args" {
            // --cbmc-args has to come last because it eats all remaining arguments
            insert_arg_from_toml(&flag, &value, &mut suffixed_args)?;
        } else {
            insert_arg_from_toml(&flag, &value, &mut args)?;
        }
    }
    args.extend(suffixed_args);
    Ok(args)
}
fn toml_to_args ( tomldata : & str ) -> Result < Vec < OsString > > { let config = tomldata . parse :: < Value > ( ) ? ; // To make testing easier, our function contract is to produce a stable ordering of flags for a given input. // Consequently, we use BTreeMap instead of HashMap here. let mut map : BTreeMap < String , Value > = BTreeMap :: new ( ) ; let tables = [ " " , " " , " " ] ; for table in tables { if let Some ( val ) = get_table ( & config , table ) { map . extend ( val . iter ( ) . map ( | ( x , y ) | ( x . to_owned ( ) , y . to_owned ( ) ) ) ) ; } } let mut args = Vec :: new ( ) ; let mut suffixed_args = Vec :: new ( ) ; for ( flag , value ) in map { if flag == " " { // --cbmc-args has to come last because it eats all remaining arguments insert_arg_from_toml ( & flag , & value , & mut suffixed_args ) ? ; } else { insert_arg_from_toml ( & flag , & value , & mut args ) ? ; } } args . extend ( suffixed_args ) ; Ok ( args ) }
Parse a config toml string and extract the cargo-kani arguments we should try injecting
Parse a config toml string and extract the cargo - kani arguments we should try injecting
tomldata
&str