rename helper methods

This commit is contained in:
Vukašin Stepanović
2023-02-15 12:52:59 +00:00
parent bfcdb397ad
commit 935519ced5
133 changed files with 858 additions and 1044 deletions

View File

@@ -64,10 +64,8 @@ impl UPCEANReader for EAN13Reader {
rowOffset,
&upc_ean_reader::L_AND_G_PATTERNS,
)?;
resultString.push(
char::from_u32('0' as u32 + bestMatch as u32 % 10)
.ok_or(Exceptions::parseEmpty())?,
);
resultString
.push(char::from_u32('0' as u32 + bestMatch as u32 % 10).ok_or(Exceptions::parse)?);
rowOffset += counters.iter().sum::<u32>() as usize;
@@ -89,9 +87,8 @@ impl UPCEANReader for EAN13Reader {
while x < 6 && rowOffset < end {
let bestMatch =
self.decodeDigit(row, &mut counters, rowOffset, &upc_ean_reader::L_PATTERNS)?;
resultString.push(
char::from_u32('0' as u32 + bestMatch as u32).ok_or(Exceptions::parseEmpty())?,
);
resultString
.push(char::from_u32('0' as u32 + bestMatch as u32).ok_or(Exceptions::parse)?);
rowOffset += counters.iter().sum::<u32>() as usize;
@@ -153,11 +150,11 @@ impl EAN13Reader {
if lgPatternFound == Self::FIRST_DIGIT_ENCODINGS[d] {
resultString.insert(
0,
char::from_u32('0' as u32 + d as u32).ok_or(Exceptions::parseEmpty())?,
char::from_u32('0' as u32 + d as u32).ok_or(Exceptions::parse)?,
);
return Ok(());
}
}
Err(Exceptions::notFoundEmpty())
Err(Exceptions::notFound)
}
}