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

@@ -59,7 +59,7 @@ impl Writer for PDF417Writer {
hints: &crate::EncodingHintDictionary,
) -> Result<crate::common::BitMatrix, crate::Exceptions> {
if format != &BarcodeFormat::PDF_417 {
return Err(Exceptions::illegalArgument(format!(
return Err(Exceptions::illegalArgumentWith(format!(
"Can only encode PDF_417, but got {format}"
)));
}
@@ -149,7 +149,7 @@ impl PDF417Writer {
let mut originalScale = encoder
.getBarcodeMatrix()
.as_ref()
.ok_or(Exceptions::illegalStateEmpty())?
.ok_or(Exceptions::illegalState)?
.getScaledMatrix(1, aspectRatio);
let mut rotated = false;
if (height > width) != (originalScale[0].len() < originalScale.len()) {
@@ -165,16 +165,16 @@ impl PDF417Writer {
let mut scaledMatrix = encoder
.getBarcodeMatrix()
.as_ref()
.ok_or(Exceptions::illegalStateEmpty())?
.ok_or(Exceptions::illegalState)?
.getScaledMatrix(scale, scale * aspectRatio);
if rotated {
scaledMatrix = Self::rotateArray(&scaledMatrix);
}
return Self::bitMatrixFromBitArray(&scaledMatrix, margin)
.ok_or(Exceptions::illegalStateEmpty());
.ok_or(Exceptions::illegalState);
}
Self::bitMatrixFromBitArray(&originalScale, margin).ok_or(Exceptions::illegalStateEmpty())
Self::bitMatrixFromBitArray(&originalScale, margin).ok_or(Exceptions::illegalState)
}
/**