From b250e8e1cb7c91370a487b7903002d0911245da5 Mon Sep 17 00:00:00 2001 From: Joakim Soderlund Date: Fri, 26 Jul 2019 20:46:33 +0000 Subject: [PATCH] Create archive module for organization --- src/{ => archive}/fetcher.rs | 4 ++-- src/archive/mod.rs | 8 ++++++++ src/{ => archive}/parser.rs | 2 +- src/{ => archive}/story.rs | 0 src/main.rs | 6 ++---- 5 files changed, 13 insertions(+), 7 deletions(-) rename src/{ => archive}/fetcher.rs (98%) create mode 100644 src/archive/mod.rs rename src/{ => archive}/parser.rs (99%) rename src/{ => archive}/story.rs (100%) diff --git a/src/fetcher.rs b/src/archive/fetcher.rs similarity index 98% rename from src/fetcher.rs rename to src/archive/fetcher.rs index 1ddbdd4..4a3aff0 100644 --- a/src/fetcher.rs +++ b/src/archive/fetcher.rs @@ -9,8 +9,8 @@ use zip::read::ZipArchive; use zip::result::ZipError; use crate::error::{Error, Result}; -use crate::parser::parse; -use crate::story::Story; +use super::parser::parse; +use super::story::Story; pub struct Fetcher where diff --git a/src/archive/mod.rs b/src/archive/mod.rs new file mode 100644 index 0000000..1216681 --- /dev/null +++ b/src/archive/mod.rs @@ -0,0 +1,8 @@ +//! Archive module. + +mod fetcher; +mod parser; +mod story; + +pub use fetcher::*; +pub use story::*; diff --git a/src/parser.rs b/src/archive/parser.rs similarity index 99% rename from src/parser.rs rename to src/archive/parser.rs index 99a6867..162ee21 100644 --- a/src/parser.rs +++ b/src/archive/parser.rs @@ -7,7 +7,7 @@ use std::thread::spawn; use serde_json::from_str; use crate::error::{Error, Result}; -use crate::story::Story; +use super::story::Story; const TRIM: &[char] = &['"', ',', ' ', '\t', '\n', '\r']; diff --git a/src/story.rs b/src/archive/story.rs similarity index 100% rename from src/story.rs rename to src/archive/story.rs diff --git a/src/main.rs b/src/main.rs index 0c8fedf..f95f08d 100644 --- a/src/main.rs +++ b/src/main.rs @@ -1,15 +1,13 @@ //! Main module. +pub mod archive; pub mod error; -pub mod fetcher; -pub mod parser; -pub mod story; use std::env::args; use std::time::Instant; +use crate::archive::Fetcher; use crate::error::{Error, Result}; -use crate::fetcher::Fetcher; fn main() -> Result<()> { use Error::*;