# Cicero Cache

Rebuild files only when needed.

```rust,no_run
use std::{fs, path::PathBuf};

let output_path = PathBuf::from("my/build/result.txt");

cicero_cache::Output::from(output_path.clone()).rebuild_on_change([
    PathBuf::from("my/build/input.csv"),
], || {
    // Your build code here

    if let Some(parent_dir) = output_path.parent() {
        fs::create_dir_all(parent_dir)?;
    }
    fs::File::create(output_path)?;
    Ok(())
});
```

List a set of input files and an output file or directory. When any of these change, it will run the build code you provide in the closure and store the new state after execution.

This is primarily useful when you have complex logic for building parts of your distribution, which can be skipped when none of the inputs changed.

External build tools, such as Cargo, Cross or Trunk, will typically bring their own caching, so wrapping their calls is typically not worth the trouble.
