Skip to main content

with_workload

Function with_workload 

Source
pub fn with_workload<F>(workload_path: &Path, mutate: F) -> Result<()>
where F: FnOnce(EditCtx<'_>) -> Result<String, String>,
Expand description

Run a workload edit transaction. The closure produces the new source content; the driver handles lock, backup, roundtrip-parse, and atomic commit.

Errors:

  • lock contention → kind WouldBlock with pid hint;
  • I/O on read / write → propagated;
  • mutation closure error → propagated, no on-disk change;
  • post-mutate parse failure → backups rolled back, no on-disk change, error explains parse failure.