mirror of
https://github.com/starovoid/rxing.git
synced 2026-07-26 12:22:34 +00:00
refactor to use common result type
This commit is contained in:
@@ -16,7 +16,10 @@
|
||||
|
||||
use rxing_one_d_proc_derive::OneDReader;
|
||||
|
||||
use crate::{common::BitArray, BarcodeFormat, Exceptions, RXingResult};
|
||||
use crate::{
|
||||
common::{BitArray, Result},
|
||||
BarcodeFormat, Exceptions, RXingResult,
|
||||
};
|
||||
|
||||
use super::{one_d_reader, OneDReader};
|
||||
|
||||
@@ -34,7 +37,7 @@ impl OneDReader for Code128Reader {
|
||||
rowNumber: u32,
|
||||
row: &crate::common::BitArray,
|
||||
hints: &crate::DecodingHintDictionary,
|
||||
) -> Result<crate::RXingResult, crate::Exceptions> {
|
||||
) -> Result<crate::RXingResult> {
|
||||
let convertFNC1 = hints.contains_key(&DecodeHintType::ASSUME_GS1);
|
||||
|
||||
let mut symbologyModifier = 0;
|
||||
@@ -354,7 +357,7 @@ impl OneDReader for Code128Reader {
|
||||
}
|
||||
}
|
||||
impl Code128Reader {
|
||||
fn findStartPattern(&self, row: &BitArray) -> Result<[usize; 3], Exceptions> {
|
||||
fn findStartPattern(&self, row: &BitArray) -> Result<[usize; 3]> {
|
||||
let width = row.getSize();
|
||||
let rowOffset = row.getNextSet(0);
|
||||
|
||||
@@ -410,12 +413,7 @@ impl Code128Reader {
|
||||
Err(Exceptions::NotFoundException(None))
|
||||
}
|
||||
|
||||
fn decodeCode(
|
||||
&self,
|
||||
row: &BitArray,
|
||||
counters: &mut [u32; 6],
|
||||
rowOffset: usize,
|
||||
) -> Result<u8, Exceptions> {
|
||||
fn decodeCode(&self, row: &BitArray, counters: &mut [u32; 6], rowOffset: usize) -> Result<u8> {
|
||||
one_d_reader::recordPattern(row, rowOffset, counters)?;
|
||||
let mut bestVariance = MAX_AVG_VARIANCE; // worst variance we'll accept
|
||||
let mut bestMatch = -1_isize;
|
||||
|
||||
Reference in New Issue
Block a user