mirror of
https://github.com/starovoid/rxing.git
synced 2026-07-27 21:02:35 +00:00
rename helper methods
This commit is contained in:
@@ -32,12 +32,12 @@ impl OneDimensionalCodeWriter for ITFWriter {
|
||||
fn encode_oned(&self, contents: &str) -> Result<Vec<bool>, Exceptions> {
|
||||
let length = contents.chars().count();
|
||||
if length % 2 != 0 {
|
||||
return Err(Exceptions::illegalArgument(
|
||||
return Err(Exceptions::illegalArgumentWith(
|
||||
"The length of the input should be even",
|
||||
));
|
||||
}
|
||||
if length > 80 {
|
||||
return Err(Exceptions::illegalArgument(format!(
|
||||
return Err(Exceptions::illegalArgumentWith(format!(
|
||||
"Requested contents should be less than 80 digits long, but got {length}"
|
||||
)));
|
||||
}
|
||||
@@ -51,15 +51,15 @@ impl OneDimensionalCodeWriter for ITFWriter {
|
||||
let one = contents
|
||||
.chars()
|
||||
.nth(i)
|
||||
.ok_or(Exceptions::indexOutOfBoundsEmpty())?
|
||||
.ok_or(Exceptions::indexOutOfBounds)?
|
||||
.to_digit(10)
|
||||
.ok_or(Exceptions::parseEmpty())? as usize;
|
||||
.ok_or(Exceptions::parse)? as usize;
|
||||
let two = contents
|
||||
.chars()
|
||||
.nth(i + 1)
|
||||
.ok_or(Exceptions::indexOutOfBoundsEmpty())?
|
||||
.ok_or(Exceptions::indexOutOfBounds)?
|
||||
.to_digit(10)
|
||||
.ok_or(Exceptions::parseEmpty())? as usize;
|
||||
.ok_or(Exceptions::parse)? as usize;
|
||||
let mut encoding = [0; 10];
|
||||
for j in 0..5 {
|
||||
encoding[2 * j] = PATTERNS[one][j];
|
||||
|
||||
Reference in New Issue
Block a user