From 9405abf4fa18b4263c49af67bfcdf176bcf2aeed Mon Sep 17 00:00:00 2001 From: Alexander_Kabui Date: Mon, 4 Jul 2022 22:31:52 +0300 Subject: add output file path --- src/parser.rs | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) (limited to 'src/parser.rs') diff --git a/src/parser.rs b/src/parser.rs index 7bddc83..97ed18a 100644 --- a/src/parser.rs +++ b/src/parser.rs @@ -1,4 +1,5 @@ use serde::Deserialize; +use std::fs::File; use std::io::Read; #[derive(Debug, Deserialize, PartialEq)] //#[serde(rename_all = "PascalCase")] @@ -9,6 +10,7 @@ pub struct JsonData { pub sample_values: String, pub method: String, pub file_delimiter: char, + pub output_file: String, } impl JsonData { @@ -158,7 +160,7 @@ mod tests { let json_struct = JsonData::new("/home/kabui/correlation_rust/tests/data/sample_json_file.json"); - let k = JsonData { file_path: String::from("/home/kabui/correlation_rust/tests/data/matrix_80.txt"), x_vals: String::from("25.08439, 72.02225, 47.56293, 22.87893, 14.28721, 71.84655, 87.81991, 84.86824, 6.72478, 5.72373, 73.47078, 63.74703"), sample_values: String::from("bxd1"),method:String::from("pearson"),file_delimiter:','}; + let k = JsonData { file_path: String::from("/home/kabui/correlation_rust/tests/data/matrix_80.txt"),output_file:String::from("/home/kabui/correlation_rust/output.txt"),x_vals: String::from("25.08439, 72.02225, 47.56293, 22.87893, 14.28721, 71.84655, 87.81991, 84.86824, 6.72478, 5.72373, 73.47078, 63.74703"), sample_values: String::from("bxd1"),method:String::from("pearson"),file_delimiter:','}; assert_eq!(k, json_struct) } -- cgit 1.4.1