diff --git a/Cargo.lock b/Cargo.lock index 5095ff2..4664450 100644 --- a/Cargo.lock +++ b/Cargo.lock @@ -28,7 +28,7 @@ name = "chrono" version = "0.4.7" source = "registry+https://github.com/rust-lang/crates.io-index" dependencies = [ - "libc 0.2.60 (registry+https://github.com/rust-lang/crates.io-index)", + "libc 0.2.61 (registry+https://github.com/rust-lang/crates.io-index)", "num-integer 0.1.41 (registry+https://github.com/rust-lang/crates.io-index)", "num-traits 0.2.8 (registry+https://github.com/rust-lang/crates.io-index)", "serde 1.0.98 (registry+https://github.com/rust-lang/crates.io-index)", @@ -111,6 +111,13 @@ dependencies = [ "zip 0.5.2 (registry+https://github.com/rust-lang/crates.io-index)", ] +[[package]] +name = "fimfareader-bin" +version = "0.1.0" +dependencies = [ + "fimfareader 0.1.0", +] + [[package]] name = "hex" version = "0.3.2" @@ -135,12 +142,12 @@ dependencies = [ "rustc_version 0.2.3 (registry+https://github.com/rust-lang/crates.io-index)", "ryu 1.0.0 (registry+https://github.com/rust-lang/crates.io-index)", "stackvector 1.0.6 (registry+https://github.com/rust-lang/crates.io-index)", - "static_assertions 0.3.3 (registry+https://github.com/rust-lang/crates.io-index)", + "static_assertions 0.3.4 (registry+https://github.com/rust-lang/crates.io-index)", ] [[package]] name = "libc" -version = "0.2.60" +version = "0.2.61" source = "registry+https://github.com/rust-lang/crates.io-index" [[package]] @@ -204,7 +211,7 @@ name = "num_cpus" version = "1.10.1" source = "registry+https://github.com/rust-lang/crates.io-index" dependencies = [ - "libc 0.2.60 (registry+https://github.com/rust-lang/crates.io-index)", + "libc 0.2.61 (registry+https://github.com/rust-lang/crates.io-index)", ] [[package]] @@ -335,7 +342,7 @@ dependencies = [ [[package]] name = "static_assertions" -version = "0.3.3" +version = "0.3.4" source = "registry+https://github.com/rust-lang/crates.io-index" [[package]] @@ -358,7 +365,7 @@ name = "time" version = "0.1.42" source = "registry+https://github.com/rust-lang/crates.io-index" dependencies = [ - "libc 0.2.60 (registry+https://github.com/rust-lang/crates.io-index)", + "libc 0.2.61 (registry+https://github.com/rust-lang/crates.io-index)", "redox_syscall 0.1.56 (registry+https://github.com/rust-lang/crates.io-index)", "winapi 0.3.7 (registry+https://github.com/rust-lang/crates.io-index)", ] @@ -432,7 +439,7 @@ dependencies = [ "checksum itoa 0.4.4 (registry+https://github.com/rust-lang/crates.io-index)" = "501266b7edd0174f8530248f87f99c88fbe60ca4ef3dd486835b8d8d53136f7f" "checksum lazy_static 1.3.0 (registry+https://github.com/rust-lang/crates.io-index)" = "bc5729f27f159ddd61f4df6228e827e86643d4d3e7c32183cb30a1c08f604a14" "checksum lexical-core 0.4.3 (registry+https://github.com/rust-lang/crates.io-index)" = "b8b0f90c979adde96d19eb10eb6431ba0c441e2f9e9bdff868b2f6f5114ff519" -"checksum libc 0.2.60 (registry+https://github.com/rust-lang/crates.io-index)" = "d44e80633f007889c7eff624b709ab43c92d708caad982295768a7b13ca3b5eb" +"checksum libc 0.2.61 (registry+https://github.com/rust-lang/crates.io-index)" = "c665266eb592905e8503ba3403020f4b8794d26263f412ca33171600eca9a6fa" "checksum libflate 0.1.26 (registry+https://github.com/rust-lang/crates.io-index)" = "45c97cf62125b79dcac52d506acdc4799f21a198597806947fd5f40dc7b93412" "checksum memchr 2.2.1 (registry+https://github.com/rust-lang/crates.io-index)" = "88579771288728879b57485cc7d6b07d648c9f0141eb955f8ab7f9d45394468e" "checksum memoffset 0.5.1 (registry+https://github.com/rust-lang/crates.io-index)" = "ce6075db033bbbb7ee5a0bbd3a3186bbae616f57fb001c485c7ff77955f8177f" @@ -458,7 +465,7 @@ dependencies = [ "checksum serde_derive 1.0.98 (registry+https://github.com/rust-lang/crates.io-index)" = "01e69e1b8a631f245467ee275b8c757b818653c6d704cdbcaeb56b56767b529c" "checksum serde_json 1.0.40 (registry+https://github.com/rust-lang/crates.io-index)" = "051c49229f282f7c6f3813f8286cc1e3323e8051823fce42c7ea80fe13521704" "checksum stackvector 1.0.6 (registry+https://github.com/rust-lang/crates.io-index)" = "1c4725650978235083241fab0fdc8e694c3de37821524e7534a1a9061d1068af" -"checksum static_assertions 0.3.3 (registry+https://github.com/rust-lang/crates.io-index)" = "b4f8de36da215253eb5f24020bfaa0646613b48bf7ebe36cdfa37c3b3b33b241" +"checksum static_assertions 0.3.4 (registry+https://github.com/rust-lang/crates.io-index)" = "7f3eb36b47e512f8f1c9e3d10c2c1965bc992bd9cdb024fa581e2194501c83d3" "checksum syn 0.15.44 (registry+https://github.com/rust-lang/crates.io-index)" = "9ca4b3b69a77cbe1ffc9e198781b7acb0c7365a883670e8f1c1bc66fba79a5c5" "checksum take_mut 0.2.2 (registry+https://github.com/rust-lang/crates.io-index)" = "f764005d11ee5f36500a149ace24e00e3da98b0158b3e2d53a7495660d3f4d60" "checksum time 0.1.42 (registry+https://github.com/rust-lang/crates.io-index)" = "db8dcfca086c1143c9270ac42a2bbd8a7ee477b78ac8e45b19abfb0cbede4b6f" diff --git a/Cargo.toml b/Cargo.toml index 41ec741..f3fa1fe 100644 --- a/Cargo.toml +++ b/Cargo.toml @@ -1,36 +1,8 @@ -[package] -name = "fimfareader" -version = "0.1.0" -authors = ["Joakim Soderlund "] -edition = "2018" - [profile.release] lto = true -[dependencies.chrono] -version = "*" -features = ["serde"] - -[dependencies.chrono-english] -version = "*" - -[dependencies.hex] -version = "*" - -[dependencies.nom] -version = "5" - -[dependencies.rayon] -version = "*" - -[dependencies.serde] -version = "*" -features = ["derive"] - -[dependencies.serde_json] -version = "*" - -[dependencies.zip] -version = "*" -features = ["deflate"] -default-features = false +[workspace] +members = [ + "bin", + "lib", +] diff --git a/bin/Cargo.toml b/bin/Cargo.toml new file mode 100644 index 0000000..d1fd898 --- /dev/null +++ b/bin/Cargo.toml @@ -0,0 +1,8 @@ +[package] +name = "fimfareader-bin" +version = "0.1.0" +authors = ["Joakim Soderlund "] +edition = "2018" + +[dependencies.fimfareader] +path = "../lib" diff --git a/src/main.rs b/bin/src/main.rs similarity index 92% rename from src/main.rs rename to bin/src/main.rs index fbe4b0d..57d624a 100644 --- a/src/main.rs +++ b/bin/src/main.rs @@ -1,18 +1,14 @@ //! Main module. -pub mod archive; -pub mod error; -pub mod query; - use std::env::args; use std::io::stdin; use std::io::stdout; use std::io::Write; use std::time::Instant; -use crate::archive::Fetcher; -use crate::error::Error; -use crate::query::parse; +use fimfareader::archive::Fetcher; +use fimfareader::error::Error; +use fimfareader::query::parse; fn exit(error: Error) -> ! { eprintln!("{}", error); diff --git a/lib/Cargo.toml b/lib/Cargo.toml new file mode 100644 index 0000000..43fdc3b --- /dev/null +++ b/lib/Cargo.toml @@ -0,0 +1,33 @@ +[package] +name = "fimfareader" +version = "0.1.0" +authors = ["Joakim Soderlund "] +edition = "2018" + +[dependencies.chrono] +version = "*" +features = ["serde"] + +[dependencies.chrono-english] +version = "*" + +[dependencies.hex] +version = "*" + +[dependencies.nom] +version = "5" + +[dependencies.rayon] +version = "*" + +[dependencies.serde] +version = "*" +features = ["derive"] + +[dependencies.serde_json] +version = "*" + +[dependencies.zip] +version = "*" +features = ["deflate"] +default-features = false diff --git a/src/archive/fetcher.rs b/lib/src/archive/fetcher.rs similarity index 100% rename from src/archive/fetcher.rs rename to lib/src/archive/fetcher.rs diff --git a/src/archive/mod.rs b/lib/src/archive/mod.rs similarity index 100% rename from src/archive/mod.rs rename to lib/src/archive/mod.rs diff --git a/src/archive/parser.rs b/lib/src/archive/parser.rs similarity index 100% rename from src/archive/parser.rs rename to lib/src/archive/parser.rs diff --git a/src/archive/story.rs b/lib/src/archive/story.rs similarity index 100% rename from src/archive/story.rs rename to lib/src/archive/story.rs diff --git a/src/error.rs b/lib/src/error.rs similarity index 100% rename from src/error.rs rename to lib/src/error.rs diff --git a/lib/src/lib.rs b/lib/src/lib.rs new file mode 100644 index 0000000..44a65f8 --- /dev/null +++ b/lib/src/lib.rs @@ -0,0 +1,5 @@ +//! Library module. + +pub mod archive; +pub mod error; +pub mod query; diff --git a/src/query/mod.rs b/lib/src/query/mod.rs similarity index 100% rename from src/query/mod.rs rename to lib/src/query/mod.rs diff --git a/src/query/optimizer.rs b/lib/src/query/optimizer.rs similarity index 100% rename from src/query/optimizer.rs rename to lib/src/query/optimizer.rs diff --git a/src/query/parser.rs b/lib/src/query/parser.rs similarity index 100% rename from src/query/parser.rs rename to lib/src/query/parser.rs