From 1a40a64097ba4d9369664d9da36ca921a833269f Mon Sep 17 00:00:00 2001 From: Henry Schimke Date: Sun, 31 Dec 2023 13:30:35 -0600 Subject: [PATCH 1/3] feat: move client decode library into a feature breaking change: Client features must be be built specificially and are not included by default. --- Cargo.toml | 3 +++ src/lib.rs | 5 ++++- 2 files changed, 7 insertions(+), 1 deletion(-) diff --git a/Cargo.toml b/Cargo.toml index 97453101..45b282b7 100644 --- a/Cargo.toml +++ b/Cargo.toml @@ -66,6 +66,9 @@ serde = ["dep:serde"] #/// Adds otsu binarizer support using imageproc otsu_level = ["image"] +#/// Adds "client" features do decode many common data formats found in barcodes +client_support = [] + [workspace] members = [ "crates/one-d-proc-derive", diff --git a/src/lib.rs b/src/lib.rs index ffecd3f9..d6675e25 100644 --- a/src/lib.rs +++ b/src/lib.rs @@ -2,12 +2,15 @@ #![allow(non_camel_case_types)] pub mod aztec; -pub mod client; + pub mod common; mod exceptions; pub mod maxicode; pub mod qrcode; +#[cfg(feature = "client_support")] +pub mod client; + use std::{collections::HashMap, rc::Rc}; pub use exceptions::Exceptions; From 0ec987b98213b17bced5cc2c5ec9d5e95ad61c6b Mon Sep 17 00:00:00 2001 From: Henry Schimke Date: Sun, 31 Dec 2023 13:40:00 -0600 Subject: [PATCH 2/3] fix: src/oned/rss/expanded/rss_expanded_image_2_result_test_case.rs test should not be run when client_support is disabled --- .../rss/expanded/rss_expanded_image_2_result_test_case.rs | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/src/oned/rss/expanded/rss_expanded_image_2_result_test_case.rs b/src/oned/rss/expanded/rss_expanded_image_2_result_test_case.rs index d6130584..1cef23b1 100644 --- a/src/oned/rss/expanded/rss_expanded_image_2_result_test_case.rs +++ b/src/oned/rss/expanded/rss_expanded_image_2_result_test_case.rs @@ -31,6 +31,7 @@ use std::collections::HashMap; +#[cfg(feature = "client_support")] use crate::{ client::result::{ExpandedProductParsedRXingResult, ParsedClientResult}, common::GlobalHistogramBinarizer, @@ -42,7 +43,7 @@ use crate::{ * @author Pablo Orduña, University of Deusto (pablo.orduna@deusto.es) * @author Eduardo Castillejo, University of Deusto (eduardo.castillejo@deusto.es) */ - +#[cfg(feature = "client_support")] #[test] fn testDecodeRow2result2() { // (01)90012345678908(3103)001750 @@ -67,6 +68,7 @@ fn testDecodeRow2result2() { assertCorrectImage2result("2.png", expected); } +#[cfg(feature = "client_support")] fn assertCorrectImage2result(fileName: &str, expected: ExpandedProductParsedRXingResult) { let path = format!("test_resources/blackbox/rssexpanded-1/{fileName}"); From 2ac70a0f2437b83c86a93a0b31464b339824d1ec Mon Sep 17 00:00:00 2001 From: Henry Schimke Date: Sun, 31 Dec 2023 13:40:12 -0600 Subject: [PATCH 3/3] fix: client_support is on by default --- Cargo.toml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/Cargo.toml b/Cargo.toml index 45b282b7..9b0c3f24 100644 --- a/Cargo.toml +++ b/Cargo.toml @@ -40,7 +40,7 @@ rand = "0.8.5" criterion = "0.5" [features] -default = ["image"] +default = ["image", "client_support"] #/// Enable features required for image manipulation and reading. image = ["dep:image", "dep:imageproc"]