cargo fmt

This commit is contained in:
Henry Schimke
2022-11-05 16:38:51 -05:00
parent 5d906edbde
commit 5e1f4c7011
7 changed files with 42 additions and 24 deletions

View File

@@ -26,7 +26,12 @@ pub struct C40Encoder;
impl Encoder for C40Encoder {
fn encode(&self, context: &mut super::EncoderContext) -> Result<(), Exceptions> {
self.encode_with_encode_char_fn(context, &Self::encodeChar_c40, &Self::handleEOD_c40, &||{self.getEncodingMode()})
self.encode_with_encode_char_fn(
context,
&Self::encodeChar_c40,
&Self::handleEOD_c40,
&|| self.getEncodingMode(),
)
}
fn getEncodingMode(&self) -> usize {

View File

@@ -544,10 +544,12 @@ fn testPadding() {
fn encodeHighLevelWithSizes(msg: &str, sizes: &mut [usize]) {
sizes[0] = high_level_encoder::encodeHighLevel(msg)
.expect("encodes")
.chars().count();
.chars()
.count();
sizes[1] = minimal_encoder::encodeHighLevel(msg)
.expect("encodes")
.chars().count();
.chars()
.count();
}
fn encodeHighLevel(msg: &str) -> String {
@@ -557,7 +559,12 @@ fn encodeHighLevel(msg: &str) -> String {
fn encodeHighLevelCompare(msg: &str, compareSizeToMinimalEncoder: bool) -> String {
let encoded = high_level_encoder::encodeHighLevel(msg).expect("encodes");
let encoded2 = minimal_encoder::encodeHighLevel(msg).expect("encodes");
assert!(!compareSizeToMinimalEncoder || encoded2.chars().count() <= encoded.chars().count(), "{} <= {}", encoded2.chars().count() , encoded.chars().count());
assert!(
!compareSizeToMinimalEncoder || encoded2.chars().count() <= encoded.chars().count(),
"{} <= {}",
encoded2.chars().count(),
encoded.chars().count()
);
visualize(&encoded)
}

View File

@@ -1302,7 +1302,8 @@ impl RXingResult {
size += Self::prepend(&Edge::getBytes1(254), &mut bytesAL);
}
let mut hold_current = Some(solution.clone());
while let Some(current) = hold_current { // Fails on i = 77 should be 151 is 144
while let Some(current) = hold_current {
// Fails on i = 77 should be 151 is 144
size += Self::prepend(&current.getDataBytes()?, &mut bytesAL);
if current.previous.is_none()

View File

@@ -1,10 +1,10 @@
mod encoder;
mod encoder_context;
pub mod error_correction;
pub mod high_level_encoder;
pub mod minimal_encoder;
mod symbol_info;
mod symbol_shape_hint;
pub mod error_correction;
pub use encoder::*;
pub use encoder_context::*;

View File

@@ -23,8 +23,12 @@ impl Encoder for TextEncoder {
}
fn encode(&self, context: &mut super::EncoderContext) -> Result<(), crate::Exceptions> {
self.0
.encode_with_encode_char_fn(context, &Self::encodeChar, &C40Encoder::handleEOD_c40, &||{self.getEncodingMode()})
self.0.encode_with_encode_char_fn(
context,
&Self::encodeChar,
&C40Encoder::handleEOD_c40,
&|| self.getEncodingMode(),
)
}
}
impl TextEncoder {