pub fn scripted_fixture_writable_with_post<T>(
script_name: impl AsRef<Path>,
version: u32,
post_process: impl FnMut(FixtureState<'_>) -> PostResult<T>,
) -> Result<(TempDir, T)>Expand description
Like scripted_fixture_writable, but runs a Rust closure after the script completes.
versionshould be incremented when the closure’s behavior changes to invalidate the cache.- The closure receives a
FixtureStateenum indicating whether the fixture is newly created (Fresh) or was loaded from cache (Cached). Both variants carry the fixture directory path. - For
Freshfixtures, the closure can modify the directory and compute values. - For
Cachedfixtures, the closure should only compute values without modifications. - The closure always runs, ensuring the returned value is always available.