pub async fn process_json_file<F, Fut>(
file_path: &Path,
processor: F,
) -> Result<()>Expand description
Processes a JSON file using a provided async processor function.
This function reads a JSON file, parses it, and applies a custom processor function to the parsed data. The processor function can perform any desired transformations or operations on the JSON data.
§Type Parameters
F- The processor function typeFut- The future type returned by the processor function
§Arguments
file_path- Path to the JSON file to processprocessor- Async function that processes the parsed JSON data
§Returns
io::Result<()>- Success or failure of the operation
§Errors
Returns an error if:
- The file cannot be read
- The content cannot be parsed as JSON
- The processor function returns an error