mirror of
https://github.com/starovoid/rxing.git
synced 2026-07-26 04:12:34 +00:00
cargo fmt
This commit is contained in:
@@ -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 {
|
||||
|
||||
@@ -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)
|
||||
}
|
||||
|
||||
|
||||
@@ -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(¤t.getDataBytes()?, &mut bytesAL);
|
||||
|
||||
if current.previous.is_none()
|
||||
|
||||
@@ -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::*;
|
||||
|
||||
@@ -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 {
|
||||
|
||||
Reference in New Issue
Block a user