diff --git a/src/main.rs b/src/main.rs index 0306a43..a099dd4 100644 --- a/src/main.rs +++ b/src/main.rs @@ -279,7 +279,8 @@ struct WriteQueueItem { type WriteQueue = Arc>>>; -async fn data_reader(queue: WriteQueue) { +/// read txt files from zip and convert to json +async fn reader_converter(queue: WriteQueue) { // open archive just to list files let archive = ZipFileReader::new(String::from(INPUT_FILENAME)) .await @@ -315,7 +316,9 @@ async fn data_reader(queue: WriteQueue) { println!("convert done ✅"); } -async fn data_writer(queue: WriteQueue) { + +/// write json data to zip files +async fn zip_writer(queue: WriteQueue) { let mut file = fs::File::create(OUTPUT_FILENAME).await.unwrap(); let mut writer = ZipFileWriter::new(&mut file); @@ -370,8 +373,8 @@ async fn main() -> Result<(), Box> { let queue_w = Arc::clone(&queue); tokio::try_join!( - tokio::spawn(data_reader(queue_r)), - tokio::spawn(data_writer(queue_w)) + tokio::spawn(reader_converter(queue_r)), + tokio::spawn(zip_writer(queue_w)) )?; println!("all done ✅");