pub fn read_json_file(
file_path: &str,
) -> Result<Vec<Interactor>, Box<dyn Error>>Expand description
Reads and processes a JSON file containing Interactor data.
This function reads a JSON file, deserializes it into a vector of Interactors, and updates the file paths for any structures referenced in the Interactors.
§Arguments
file_path- A string slice that holds the path to the JSON file.
§Returns
Ok(Vec<Interactor>)- A vector of Interactor objects if successful.Err(Box<dyn std::error::Error>)- An error if file reading or JSON parsing fails.
§Errors
This function will return an error if:
- The file cannot be opened
- The JSON is invalid or cannot be deserialized into
Vec<Interactor> - Any referenced structure file does not exist
§Panics
The function will call process::exit(1) if a referenced structure file does not exist.