From 61587132a3970b1ab413857aa6efc56cd195f9ef Mon Sep 17 00:00:00 2001 From: Dmitry Date: Tue, 20 Sep 2022 14:35:47 +0300 Subject: [PATCH] reader/writer rename --- src/main.rs | 11 +++++++---- 1 file changed, 7 insertions(+), 4 deletions(-) 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 ✅");