pub fn string_to_file(
str_content: &str,
file_name: impl AsRef<Path>,
) -> RuntimeResult<()>Expand description
Replaces a file with UTF-8 content, keeping the previous bytes in a sibling
.bak file.
Both files are written through the atomic metadata replacement protocol:
a synchronized temporary file, an atomic rename, and a parent-directory
synchronization where the platform supports it. Calls through this helper
are serialized within the process. The call blocks, so asynchronous code
runs it through a blocking lane such as
ChildServiceContext::metadata_io,
or persists through a MetadataIoActor.
ยงErrors
Returns an I/O-classified failure when the previous content cannot be read, or a metadata persistence failure when either replacement fails.