Skip to main content

with_file_mutation_queue

Function with_file_mutation_queue 

Source
pub async fn with_file_mutation_queue<F, R>(
    env: &dyn MutatingEnv,
    path: &str,
    cancel: &CancellationToken,
    f: F,
) -> Result<R, FileError>
where F: for<'a> FnOnce(&'a CancellationToken) -> BoxFuture<'a, Result<R, FileError>>, R: Send + 'static,
Expand description

Serialize fn per canonical-path key for env. The closure f runs while holding the per-key tokio::Mutex guard; abort/cancel during the wait does NOT skip the queue — f itself must observe the token and return Err(FileError::aborted()).

Mirrors withFileMutationQueue. The &CancellationToken is passed to f so it can perform the same pre/post-execution abort checks the tools do (the write tool checks before AND after the write).