Skip to main content

Module atomic_save

Module atomic_save 

Source
Expand description

Crash-safe atomic file writes — re-exported from par-term-config.

The implementation lives in par_term_config::atomic_save. It had to move out of the root crate because par-term-config, par-term-settings-ui and par-term-update all write files that must be atomic and none of them can depend on the root crate; a Layer-1 home is the only one all four can reach. Duplicating a security-sensitive write path into a second crate was the alternative and was rejected.

This module stays so that existing crate::atomic_save::… call sites keep working. See the upstream module for the durability and permission contracts, including when to prefer save_string_atomic_preserving_mode over the 0o600-forcing variants.

Functions§

save_bytes_atomic
Atomically replace path with bytes, forcing mode 0o600.
save_bytes_atomic_preserving_mode
Atomically replace path with bytes, keeping the target’s current mode.
save_string_atomic
Atomically replace path with contents, forcing mode 0o600.
save_string_atomic_preserving_mode
Atomically replace path with contents, keeping the target’s current mode.
save_yaml_atomic
Serialize value as YAML and atomically replace path with it, forcing mode 0o600.