pub fn write_json_file(hash_set: &FileList, output_file_name: &str)Expand description
Write a FileList struct to a JSON file.
This function serializes a given FileList struct into a JSON-formatted string,
and writes it to the specified output file. The JSON is formatted with indentation
for readability.
If the serialization fails or if there are issues with file I/O, appropriate error messages are logged.
§Arguments
hash_set- TheFileListstruct to be serialized and written to the JSON file.
§Examples
use file_integrity::{write_json_file, FileList};
let file_list = FileList {
date: "2023-08-10".to_string(),
files: vec![/* FileInfo entries */],
};
let file_name = "output.json" ;
write_json_file(&file_list, &file_name);§Errors
This function can return an error if serialization to JSON fails or if there are issues with file I/O operations.