pub async fn write_to_file(
target_path: impl AsRef<Path>,
serialized_json: &str,
) -> Result<(), Error>Expand description
Writes serialized JSON content to a file asynchronously.
§Arguments
target_path- A reference to the path where the file will be written.serialized_json- The JSON content as a string to write to the file.
§Returns
Result<(), io::Error>-Ok(())if the write succeeds, or anio::Errorotherwise.
§Errors
- Returns an
io::Errorif file creation, writing, or flushing fails.