Skip to main content

write_atomic

Function write_atomic 

Source
pub fn write_atomic(path: &Path, bytes: &[u8]) -> Result<(), AppError>
Expand description

Atomically write bytes to path (create or overwrite).

Mirrors the atomwrite CLI contract used by LLM agents: crash-safe, same-filesystem rename, parent-dir fsync on Unix.

§Errors

Returns AppError::Io when any step of the write/rename sequence fails. Returns AppError::Validation when path has no parent directory component.