AUDIO
Source snapshot · 12 October 2026

API reference / ravet_runtime::files::atomic_write

Function atomic_write 

pub fn atomic_write(
    path: impl AsRef<Path>,
    bytes: &[u8],
) -> Result<(), FileError>
Expand description

Create parent directories, write an exclusive same-directory temporary, flush its content, then atomically replace the destination on supported OSes. A failed replacement preserves the old destination and cleans the temporary. Does not sync the parent directory or promise power-loss durability.

ravet_runtime::files::atomic_write(path, b"complete state")?;
assert_eq!(ravet_runtime::files::read(path, 32)?, b"complete state");