Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

feat: make client builds optional #41

Merged
merged 3 commits into from
Jan 2, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
5 changes: 4 additions & 1 deletion Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -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"]

Expand All @@ -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",
Expand Down
5 changes: 4 additions & 1 deletion src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -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;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -31,6 +31,7 @@

use std::collections::HashMap;

#[cfg(feature = "client_support")]
use crate::{
client::result::{ExpandedProductParsedRXingResult, ParsedClientResult},
common::GlobalHistogramBinarizer,
Expand All @@ -42,7 +43,7 @@ use crate::{
* @author Pablo Orduña, University of Deusto ([email protected])
* @author Eduardo Castillejo, University of Deusto ([email protected])
*/

#[cfg(feature = "client_support")]
#[test]
fn testDecodeRow2result2() {
// (01)90012345678908(3103)001750
Expand All @@ -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}");

Expand Down