Skip to main content

write_wrap

Function write_wrap 

Source
pub fn write_wrap(
    dir: &Path,
    report: &WrapReport,
) -> Result<PathBuf, SessionError>
Expand description

Persist a wrap report as <dir>/<session_ulid>.json, creating dir if needed. Returns the final path.

Atomicity: write-to-temp-then-rename so a crash mid-write never leaves a half-written wrap. The rename target name is stable, so two concurrent writes (e.g. a double-wrap race) are last-writer-wins without corruption.

ยงErrors

Returns crate::SessionError::Io for any filesystem issue (directory create, temp-write, rename) and crate::SessionError::Serde if serialisation fails.