From 698245f20e29fa34132f5706bd98463c82cd489e Mon Sep 17 00:00:00 2001 From: mike Date: Mon, 22 Jul 2024 13:14:06 +0200 Subject: [PATCH] feat: do not use multi module project --- Cargo.lock | 11 +----- Cargo.toml | 32 ++++++++++++++---- cli/Cargo.toml | 21 ------------ lib/Cargo.toml | 20 ----------- {cli/src => src}/args.rs | 0 {lib/src => src}/lib.rs | 8 ++--- {cli/src => src}/main.rs | 5 +-- {lib/src => src}/models/address.rs | 0 {lib/src => src}/models/mod.rs | 0 {lib/src => src}/models/qr_data.rs | 0 {lib/src => src}/pdf_converter.rs | 0 {lib/src => src}/qr_parser.rs | 0 {lib/tests => tests}/data/double.pdf | Bin {lib/tests => tests}/data/double.png | Bin {lib/tests => tests}/data/full.pdf | Bin {lib/tests => tests}/data/full.png | Bin {lib/tests => tests}/data/minimal.pdf | Bin {lib/tests => tests}/data/minimal.png | Bin {lib/tests => tests}/data/none.pdf | Bin {lib/tests => tests}/data/none.png | Bin {lib/tests => tests}/data/rotated.pdf | Bin {lib/tests => tests}/data/rotated.png | Bin {lib/tests => tests}/data/six_examples/01.png | Bin {lib/tests => tests}/data/six_examples/02.png | Bin {lib/tests => tests}/data/six_examples/03.png | Bin {lib/tests => tests}/data/six_examples/04.png | Bin {lib/tests => tests}/data/six_examples/05.png | Bin {lib/tests => tests}/data/six_examples/06.png | Bin {lib/tests => tests}/edge_cases.rs | 7 ++-- {lib/tests => tests}/six_examples.rs | 6 ++-- 30 files changed, 39 insertions(+), 71 deletions(-) delete mode 100644 cli/Cargo.toml delete mode 100644 lib/Cargo.toml rename {cli/src => src}/args.rs (100%) rename {lib/src => src}/lib.rs (100%) rename {cli/src => src}/main.rs (92%) rename {lib/src => src}/models/address.rs (100%) rename {lib/src => src}/models/mod.rs (100%) rename {lib/src => src}/models/qr_data.rs (100%) rename {lib/src => src}/pdf_converter.rs (100%) rename {lib/src => src}/qr_parser.rs (100%) rename {lib/tests => tests}/data/double.pdf (100%) rename {lib/tests => tests}/data/double.png (100%) rename {lib/tests => tests}/data/full.pdf (100%) rename {lib/tests => tests}/data/full.png (100%) rename {lib/tests => tests}/data/minimal.pdf (100%) rename {lib/tests => tests}/data/minimal.png (100%) rename {lib/tests => tests}/data/none.pdf (100%) rename {lib/tests => tests}/data/none.png (100%) rename {lib/tests => tests}/data/rotated.pdf (100%) rename {lib/tests => tests}/data/rotated.png (100%) rename {lib/tests => tests}/data/six_examples/01.png (100%) rename {lib/tests => tests}/data/six_examples/02.png (100%) rename {lib/tests => tests}/data/six_examples/03.png (100%) rename {lib/tests => tests}/data/six_examples/04.png (100%) rename {lib/tests => tests}/data/six_examples/05.png (100%) rename {lib/tests => tests}/data/six_examples/06.png (100%) rename {lib/tests => tests}/edge_cases.rs (97%) rename {lib/tests => tests}/six_examples.rs (97%) diff --git a/Cargo.lock b/Cargo.lock index d6fd423..38e8a4d 100644 --- a/Cargo.lock +++ b/Cargo.lock @@ -1169,18 +1169,9 @@ dependencies = [ "assert-json-diff", "assert_cmd", "clap", - "indoc", - "predicates", - "serde_json", - "swiss-qr-bill-decoder-lib", -] - -[[package]] -name = "swiss-qr-bill-decoder-lib" -version = "0.1.0" -dependencies = [ "image", "indoc", + "predicates", "rqrr", "serde", "serde_json", diff --git a/Cargo.toml b/Cargo.toml index fae1719..f0a24fb 100644 --- a/Cargo.toml +++ b/Cargo.toml @@ -1,12 +1,30 @@ -[workspace] -members = [ - "lib", - "cli", -] -resolver = "2" +[package] +name = "swiss-qr-bill-decoder" +version = "0.1.0" +edition = "2021" +publish = false +authors = ["Mike Schmid "] +description = "A simple tool to decode QR codes of Swiss QR bills" + +[lints.rust] +unsafe_code = "forbid" [profile.release] codegen-units = 1 lto = "fat" strip = "symbols" -panic = "abort" \ No newline at end of file +panic = "abort" + +[dependencies] +clap = { version = "4.5.7", features = ["derive"] } +serde_json = "1.0.117" +rqrr = "0.7.1" +image = "0.25.1" +tempfile = "3.10.1" +serde = { version = "1.0.203", features = ["derive"] } + +[dev-dependencies] +assert_cmd = "2.0.14" +predicates = "3.1.0" +indoc = "2.0.5" +assert-json-diff = "2.0.2" \ No newline at end of file diff --git a/cli/Cargo.toml b/cli/Cargo.toml deleted file mode 100644 index 0fd6b24..0000000 --- a/cli/Cargo.toml +++ /dev/null @@ -1,21 +0,0 @@ -[package] -name = "swiss-qr-bill-decoder" -version = "0.1.0" -edition = "2021" -publish = false -authors = ["Mike Schmid "] -description = "A simple cli tool to decode QR codes of Swiss QR bills" - -[lints.rust] -unsafe_code = "forbid" - -[dependencies] -clap = { version = "4.5.7", features = ["derive"] } -serde_json = "1.0.117" -swiss-qr-bill-decoder-lib = { path = "../lib" } - -[dev-dependencies] -assert_cmd = "2.0.14" -predicates = "3.1.0" -indoc = "2.0.5" -assert-json-diff = "2.0.2" diff --git a/lib/Cargo.toml b/lib/Cargo.toml deleted file mode 100644 index 34d3cb0..0000000 --- a/lib/Cargo.toml +++ /dev/null @@ -1,20 +0,0 @@ -[package] -name = "swiss-qr-bill-decoder-lib" -version = "0.1.0" -edition = "2021" -publish = false -authors = ["Mike Schmid "] -description = "A simple library to decode QR codes of Swiss QR bills" - -[lints.rust] -unsafe_code = "forbid" - -[dependencies] -rqrr = "0.7.1" -image = "0.25.1" -tempfile = "3.10.1" -serde_json = "1.0.117" -serde = { version = "1.0.203", features = ["derive"] } - -[dev-dependencies] -indoc = "2.0.5" \ No newline at end of file diff --git a/cli/src/args.rs b/src/args.rs similarity index 100% rename from cli/src/args.rs rename to src/args.rs diff --git a/lib/src/lib.rs b/src/lib.rs similarity index 100% rename from lib/src/lib.rs rename to src/lib.rs index beb6d1e..862c6a6 100644 --- a/lib/src/lib.rs +++ b/src/lib.rs @@ -4,15 +4,15 @@ //! //! See [the standard definition](https://www.six-group.com/de/products-services/banking-services/payment-standardization/standards/qr-bill.html#ig-qr-bill-v2.3) +pub mod models; +mod pdf_converter; +mod qr_parser; + use crate::models::qr_data::QRData; use image; use rqrr::PreparedImage; use tempfile::tempdir; -pub mod models; -mod pdf_converter; -mod qr_parser; - pub fn get_qr_bill_data(file_path: String, fail_on_error: bool) -> Vec { let tmp_dir = tempdir().expect("Error creating temporary directory"); let images = match file_path.as_str() { diff --git a/cli/src/main.rs b/src/main.rs similarity index 92% rename from cli/src/main.rs rename to src/main.rs index 71d4bb0..624d9b2 100644 --- a/cli/src/main.rs +++ b/src/main.rs @@ -4,9 +4,10 @@ //! //! See [the standard definition](https://www.six-group.com/de/products-services/banking-services/payment-standardization/standards/qr-bill.html#ig-qr-bill-v2.3) +mod args; + use clap::Parser; -use swiss_qr_bill_decoder_lib::get_qr_bill_data; - mod args; +use swiss_qr_bill_decoder::get_qr_bill_data; fn main() { let args = args::Args::parse(); diff --git a/lib/src/models/address.rs b/src/models/address.rs similarity index 100% rename from lib/src/models/address.rs rename to src/models/address.rs diff --git a/lib/src/models/mod.rs b/src/models/mod.rs similarity index 100% rename from lib/src/models/mod.rs rename to src/models/mod.rs diff --git a/lib/src/models/qr_data.rs b/src/models/qr_data.rs similarity index 100% rename from lib/src/models/qr_data.rs rename to src/models/qr_data.rs diff --git a/lib/src/pdf_converter.rs b/src/pdf_converter.rs similarity index 100% rename from lib/src/pdf_converter.rs rename to src/pdf_converter.rs diff --git a/lib/src/qr_parser.rs b/src/qr_parser.rs similarity index 100% rename from lib/src/qr_parser.rs rename to src/qr_parser.rs diff --git a/lib/tests/data/double.pdf b/tests/data/double.pdf similarity index 100% rename from lib/tests/data/double.pdf rename to tests/data/double.pdf diff --git a/lib/tests/data/double.png b/tests/data/double.png similarity index 100% rename from lib/tests/data/double.png rename to tests/data/double.png diff --git a/lib/tests/data/full.pdf b/tests/data/full.pdf similarity index 100% rename from lib/tests/data/full.pdf rename to tests/data/full.pdf diff --git a/lib/tests/data/full.png b/tests/data/full.png similarity index 100% rename from lib/tests/data/full.png rename to tests/data/full.png diff --git a/lib/tests/data/minimal.pdf b/tests/data/minimal.pdf similarity index 100% rename from lib/tests/data/minimal.pdf rename to tests/data/minimal.pdf diff --git a/lib/tests/data/minimal.png b/tests/data/minimal.png similarity index 100% rename from lib/tests/data/minimal.png rename to tests/data/minimal.png diff --git a/lib/tests/data/none.pdf b/tests/data/none.pdf similarity index 100% rename from lib/tests/data/none.pdf rename to tests/data/none.pdf diff --git a/lib/tests/data/none.png b/tests/data/none.png similarity index 100% rename from lib/tests/data/none.png rename to tests/data/none.png diff --git a/lib/tests/data/rotated.pdf b/tests/data/rotated.pdf similarity index 100% rename from lib/tests/data/rotated.pdf rename to tests/data/rotated.pdf diff --git a/lib/tests/data/rotated.png b/tests/data/rotated.png similarity index 100% rename from lib/tests/data/rotated.png rename to tests/data/rotated.png diff --git a/lib/tests/data/six_examples/01.png b/tests/data/six_examples/01.png similarity index 100% rename from lib/tests/data/six_examples/01.png rename to tests/data/six_examples/01.png diff --git a/lib/tests/data/six_examples/02.png b/tests/data/six_examples/02.png similarity index 100% rename from lib/tests/data/six_examples/02.png rename to tests/data/six_examples/02.png diff --git a/lib/tests/data/six_examples/03.png b/tests/data/six_examples/03.png similarity index 100% rename from lib/tests/data/six_examples/03.png rename to tests/data/six_examples/03.png diff --git a/lib/tests/data/six_examples/04.png b/tests/data/six_examples/04.png similarity index 100% rename from lib/tests/data/six_examples/04.png rename to tests/data/six_examples/04.png diff --git a/lib/tests/data/six_examples/05.png b/tests/data/six_examples/05.png similarity index 100% rename from lib/tests/data/six_examples/05.png rename to tests/data/six_examples/05.png diff --git a/lib/tests/data/six_examples/06.png b/tests/data/six_examples/06.png similarity index 100% rename from lib/tests/data/six_examples/06.png rename to tests/data/six_examples/06.png diff --git a/lib/tests/edge_cases.rs b/tests/edge_cases.rs similarity index 97% rename from lib/tests/edge_cases.rs rename to tests/edge_cases.rs index a348e86..7df1f8a 100644 --- a/lib/tests/edge_cases.rs +++ b/tests/edge_cases.rs @@ -1,7 +1,6 @@ -use swiss_qr_bill_decoder_lib::get_qr_bill_data; -use swiss_qr_bill_decoder_lib::models::address::Address; -use swiss_qr_bill_decoder_lib::models::qr_data::QRData; - +use swiss_qr_bill_decoder::get_qr_bill_data; +use swiss_qr_bill_decoder::models::address::Address; +use swiss_qr_bill_decoder::models::qr_data::QRData; #[test] fn minimal_png() { diff --git a/lib/tests/six_examples.rs b/tests/six_examples.rs similarity index 97% rename from lib/tests/six_examples.rs rename to tests/six_examples.rs index 4390348..60be5df 100644 --- a/lib/tests/six_examples.rs +++ b/tests/six_examples.rs @@ -1,6 +1,6 @@ -use swiss_qr_bill_decoder_lib::get_qr_bill_data; -use swiss_qr_bill_decoder_lib::models::address::Address; -use swiss_qr_bill_decoder_lib::models::qr_data::QRData; +use swiss_qr_bill_decoder::get_qr_bill_data; +use swiss_qr_bill_decoder::models::address::Address; +use swiss_qr_bill_decoder::models::qr_data::QRData; #[test] fn six_example_01() {