Function write_to_file

Source
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 created/overwritten.
  • serialized_json - The JSON content as a string to write.

§Returns

  • Result<(), io::Error> - Ok(()) if successful, or an io::Error otherwise.