pub(crate) fn cache_generated_file<F: FnOnce(PathBuf) -> Fallible<PathBuf>>(
    cache_path: &Path,
    results_path: &Path,
    f: F,
) -> Fallible<PathBuf> {
    let abs_path = cache_path.join(results_path);

    if abs_path.exists() {
        Ok(abs_path)
    } else {
        let abs_path = f(abs_path)?;

        if abs_path.exists() {
            Ok(abs_path)
        } else {
            bail!(
                "The result file {} was not created as expected",
                abs_path.display()
            )
        }
    }
}
/// Lower-level caching function.  Given some arbitrary file name (and optional path components)
/// relative to the cache path, if the file exists, returns the fully qualified path to the file in
/// the cache, if not, it passes that fully qualified path to the provided closure, and if that
/// closure succeeds and the file was created, then this function returns the fully qualified path.
///
/// If the closure returns an error, or if it returns success but the file still doesn't exist,
/// this function fails
Lower-level caching function.  Given some arbitrary file name (and optional path components)
relative to the cache path, if the file exists, returns the fully qualified path to the file in
the cache, if not, it passes that fully qualified path to the provided closure, and if that
closure succeeds and the file was created, then this function returns the fully qualified path.

If the closure returns an error, or if it returns success but the file still doesn't exist,
this function fails
Lower - level caching function . Given some arbitrary file name ( and optional path components ) relative to the cache path if the file exists returns the fully qualified path to the file in the cache if not it passes that fully qualified path to the provided closure and if that closure succeeds and the file was created then this function returns the fully qualified path . If the closure returns an error or if it returns success but the file still doesn ' t exist this function fails
pub(crate) fn cache_generated_file<F: FnOnce(PathBuf) -> Fallible<PathBuf>>(
    cache_path: &Path,
    results_path: &Path,
    f: F,
) -> Fallible<PathBuf> {
    let abs_path = cache_path.join(results_path);
    if abs_path.exists() {
        Ok(abs_path)
    } else {
        let abs_path = f(abs_path)?;
        if abs_path.exists() {
            Ok(abs_path)
        } else {
            bail!(
                "The result file {} was not created as expected",
                abs_path.display()
            )
        }
    }
}
pub ( crate ) fn cache_generated_file < F : FnOnce ( PathBuf ) -> Fallible < PathBuf > > ( cache_path : & Path , results_path : & Path , f : F , ) -> Fallible < PathBuf > { let abs_path = cache_path . join ( results_path ) ; if abs_path . exists ( ) { Ok ( abs_path ) } else { let abs_path = f ( abs_path ) ? ; if abs_path . exists ( ) { Ok ( abs_path ) } else { bail ! ( " " abs_path display ( ) ) } } }
Lower-level caching function.
Lower - level caching function .
cache_path
&Path
results_path
&Path
f
F
cache_path
&Path
results_path
&Path
f
F