From 05e377e85baea935d84f6c386d39fd6caa87dc48 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Vuka=C5=A1in=20Stepanovi=C4=87?= Date: Thu, 16 Feb 2023 08:31:35 +0000 Subject: [PATCH] add aliases so the OneDReader proc macro compiles Currently it's not possible to rename RXingResultPoint to Point cleanly, since the external OneDReader proc macro makes use of them. For the time being, simple aliases are introduced to get the code to compile, but the plan is to remove them at a later point. --- src/oned/coda_bar_reader.rs | 2 +- src/oned/code_128_reader.rs | 2 +- src/oned/code_39_reader.rs | 2 +- src/oned/code_93_reader.rs | 2 +- src/oned/itf_reader.rs | 2 +- src/rxing_result.rs | 10 ++++++++++ src/rxing_result_point.rs | 3 +++ 7 files changed, 18 insertions(+), 5 deletions(-) diff --git a/src/oned/coda_bar_reader.rs b/src/oned/coda_bar_reader.rs index eed8a89..5a7ed0d 100644 --- a/src/oned/coda_bar_reader.rs +++ b/src/oned/coda_bar_reader.rs @@ -17,7 +17,7 @@ use rxing_one_d_proc_derive::OneDReader; use crate::common::{BitArray, Result}; -use crate::BarcodeFormat; +use crate::{BarcodeFormat, Point}; use crate::DecodeHintValue; use crate::Exceptions; use crate::RXingResult; diff --git a/src/oned/code_128_reader.rs b/src/oned/code_128_reader.rs index 2978606..f872399 100644 --- a/src/oned/code_128_reader.rs +++ b/src/oned/code_128_reader.rs @@ -18,7 +18,7 @@ use rxing_one_d_proc_derive::OneDReader; use crate::{ common::{BitArray, Result}, - BarcodeFormat, Exceptions, RXingResult, + BarcodeFormat, Exceptions, RXingResult, Point, }; use super::{one_d_reader, OneDReader}; diff --git a/src/oned/code_39_reader.rs b/src/oned/code_39_reader.rs index 04b9aaa..fa32fce 100644 --- a/src/oned/code_39_reader.rs +++ b/src/oned/code_39_reader.rs @@ -17,7 +17,7 @@ use rxing_one_d_proc_derive::OneDReader; use crate::common::{BitArray, Result}; -use crate::{BarcodeFormat, Exceptions, RXingResult}; +use crate::{BarcodeFormat, Exceptions, RXingResult, Point}; use super::{one_d_reader, OneDReader}; diff --git a/src/oned/code_93_reader.rs b/src/oned/code_93_reader.rs index d2e890c..fa22630 100644 --- a/src/oned/code_93_reader.rs +++ b/src/oned/code_93_reader.rs @@ -18,7 +18,7 @@ use rxing_one_d_proc_derive::OneDReader; use crate::{ common::{BitArray, Result}, - BarcodeFormat, Exceptions, RXingResult, + BarcodeFormat, Exceptions, RXingResult, Point, }; use super::{one_d_reader, OneDReader}; diff --git a/src/oned/itf_reader.rs b/src/oned/itf_reader.rs index fb54549..8e616b2 100644 --- a/src/oned/itf_reader.rs +++ b/src/oned/itf_reader.rs @@ -18,7 +18,7 @@ use rxing_one_d_proc_derive::OneDReader; use crate::{ common::{BitArray, Result}, - BarcodeFormat, DecodeHintValue, Exceptions, RXingResult, + BarcodeFormat, DecodeHintValue, Exceptions, RXingResult, Point, }; use super::{one_d_reader, OneDReader}; diff --git a/src/rxing_result.rs b/src/rxing_result.rs index 7fde804..e0c20a3 100644 --- a/src/rxing_result.rs +++ b/src/rxing_result.rs @@ -130,6 +130,16 @@ impl RXingResult { &mut self.resultPoints } + /** Currently necessary because the external OneDReader proc macro uses it. */ + pub fn getRXingResultPoints(&self) -> &Vec { + &&self.resultPoints + } + + /** Currently necessary because the external OneDReader proc macro uses it. */ + pub fn getRXingResultPointsMut(&mut self) -> &mut Vec { + &mut self.resultPoints + } + /** * @return {@link BarcodeFormat} representing the format of the barcode that was decoded */ diff --git a/src/rxing_result_point.rs b/src/rxing_result_point.rs index 70bb447..eb617e3 100644 --- a/src/rxing_result_point.rs +++ b/src/rxing_result_point.rs @@ -19,6 +19,9 @@ pub struct Point { pub(crate) y: f32, } +/** Currently necessary because the external OneDReader proc macro uses it. */ +pub type RXingResultPoint = Point; + impl Hash for Point { fn hash(&self, state: &mut H) { self.x.to_string().hash(state);