fn collect_and_link_function_pointer_restrictions(
    path: &Path,
    output_filename: &Path,
) -> Result<()> {
    let md = std::fs::metadata(path)?;

    // Fill with data from all files in that path with the expected suffix
    let mut per_crate_restrictions = Vec::new();

    if md.is_dir() {
        for element in path.read_dir()? {
            let path = element?.path();
            if path.as_os_str().to_str().unwrap().ends_with(".restrictions.json") {
                let restrictions = read_restrictions(&path)?;
                per_crate_restrictions.push(restrictions);
            }
        }
    } else if md.is_file() {
        assert!(path.as_os_str().to_str().unwrap().ends_with(".restrictions.json"));
        let restrictions = read_restrictions(path)?;
        per_crate_restrictions.push(restrictions);
    } else {
        unreachable!("Path must be restrcitions file or directory containing restrictions files")
    }

    link_function_pointer_restrictions(per_crate_restrictions, output_filename)
}
/// From either a file or a path with multiple files, output the CBMC restrictions file we should use.
From either a file or a path with multiple files, output the CBMC restrictions file we should use.
From either a file or a path with multiple files output the CBMC restrictions file we should use .
fn collect_and_link_function_pointer_restrictions(
    path: &Path,
    output_filename: &Path,
) -> Result<()> {
    let md = std::fs::metadata(path)?;
    // Fill with data from all files in that path with the expected suffix
    let mut per_crate_restrictions = Vec::new();
    if md.is_dir() {
        for element in path.read_dir()? {
            let path = element?.path();
            if path.as_os_str().to_str().unwrap().ends_with(".restrictions.json") {
                let restrictions = read_restrictions(&path)?;
                per_crate_restrictions.push(restrictions);
            }
        }
    } else if md.is_file() {
        assert!(path.as_os_str().to_str().unwrap().ends_with(".restrictions.json"));
        let restrictions = read_restrictions(path)?;
        per_crate_restrictions.push(restrictions);
    } else {
        unreachable!("Path must be restrcitions file or directory containing restrictions files")
    }
    link_function_pointer_restrictions(per_crate_restrictions, output_filename)
}
fn collect_and_link_function_pointer_restrictions ( path : & Path , output_filename : & Path , ) -> Result < ( ) > { let md = std :: fs :: metadata ( path ) ? ; // Fill with data from all files in that path with the expected suffix let mut per_crate_restrictions = Vec :: new ( ) ; if md . is_dir ( ) { for element in path . read_dir ( ) ? { let path = element ? . path ( ) ; if path . as_os_str ( ) . to_str ( ) . unwrap ( ) . ends_with ( " " ) { let restrictions = read_restrictions ( & path ) ? ; per_crate_restrictions . push ( restrictions ) ; } } } else if md . is_file ( ) { assert ! ( path as_os_str ( ) to_str ( ) unwrap ( ) ends_with ( " " ) ) ; let restrictions = read_restrictions ( path ) ? ; per_crate_restrictions . push ( restrictions ) ; } else { unreachable ! ( " " ) } link_function_pointer_restrictions ( per_crate_restrictions , output_filename ) }
From either a file or a path with multiple files, output the CBMC restrictions file we should use.
From either a file or a path with multiple files output the CBMC restrictions file we should use .
path
&Path
output_filename
&Path