Skip to main content

write_atomic

Function write_atomic 

Source
pub fn write_atomic(
    trajectory: &Trajectory,
    path: &Path,
) -> Result<(), WriterError>
Expand description

Write a trajectory to path atomically: serialize → temp file in the same directory → fsync → rename. A crash can leave a stale .tmp file but never a torn trajectory (silent-error class D13.16). The trajectory is validated (strict) before any byte is written — this crate never produces an invalid file (success criterion R28).

A directory synchronization failure is returned even if rename already made the trajectory visible. Callers must retain the complete file for recovery or retry, and must not attest successful durable capture until the write succeeds. See av_core::fsutil::write_atomic for the shared contract.