diff --git a/src/aztec/aztec_writer.rs b/src/aztec/aztec_writer.rs index 0c050f1..7335fa0 100644 --- a/src/aztec/aztec_writer.rs +++ b/src/aztec/aztec_writer.rs @@ -28,6 +28,7 @@ use super::encoder::{encoder, AztecCode}; /** * Renders an Aztec code as a {@link BitMatrix}. */ +#[derive(Default)] pub struct AztecWriter; impl Writer for AztecWriter { diff --git a/src/datamatrix/data_matrix_writer.rs b/src/datamatrix/data_matrix_writer.rs index a85355c..58bae0c 100644 --- a/src/datamatrix/data_matrix_writer.rs +++ b/src/datamatrix/data_matrix_writer.rs @@ -37,6 +37,7 @@ use super::encoder::error_correction; * @author dswitkin@google.com (Daniel Switkin) * @author Guillaume Le Biller Added to zxing lib. */ +#[derive(Default)] pub struct DataMatrixWriter; impl Writer for DataMatrixWriter { diff --git a/src/multi_format_writer.rs b/src/multi_format_writer.rs index 572e5af..9c6114e 100644 --- a/src/multi_format_writer.rs +++ b/src/multi_format_writer.rs @@ -23,8 +23,9 @@ use crate::{ Code128Writer, Code39Writer, Code93Writer, EAN13Writer, EAN8Writer, ITFWriter, UPCAWriter, UPCEWriter, }, + pdf417::PDF417Writer, qrcode::QRCodeWriter, - BarcodeFormat, Exceptions, Writer, pdf417::PDF417Writer, + BarcodeFormat, Exceptions, Writer, }; /** @@ -55,19 +56,19 @@ impl Writer for MultiFormatWriter { hints: &crate::EncodingHintDictionary, ) -> Result { let writer: Box = match format { - BarcodeFormat::EAN_8 => Box::new(EAN8Writer::default()), - BarcodeFormat::UPC_E => Box::new(UPCEWriter::default()), - BarcodeFormat::EAN_13 => Box::new(EAN13Writer::default()), - BarcodeFormat::UPC_A => Box::new(UPCAWriter::default()), - BarcodeFormat::QR_CODE => Box::new(QRCodeWriter {}), - BarcodeFormat::CODE_39 => Box::new(Code39Writer::default()), - BarcodeFormat::CODE_93 => Box::new(Code93Writer::default()), - BarcodeFormat::CODE_128 => Box::new(Code128Writer::default()), - BarcodeFormat::ITF => Box::new(ITFWriter::default()), - BarcodeFormat::PDF_417 => Box::new(PDF417Writer::default()), - BarcodeFormat::CODABAR => Box::new(Code128Writer::default()), - BarcodeFormat::DATA_MATRIX => Box::new(DataMatrixWriter {}), - BarcodeFormat::AZTEC => Box::new(AztecWriter {}), + BarcodeFormat::EAN_8 => Box::::default(), + BarcodeFormat::UPC_E => Box::::default(), + BarcodeFormat::EAN_13 => Box::::default(), + BarcodeFormat::UPC_A => Box::::default(), + BarcodeFormat::QR_CODE => Box::::default(), + BarcodeFormat::CODE_39 => Box::::default(), + BarcodeFormat::CODE_93 => Box::::default(), + BarcodeFormat::CODE_128 => Box::::default(), + BarcodeFormat::ITF => Box::::default(), + BarcodeFormat::PDF_417 => Box::::default(), + BarcodeFormat::CODABAR => Box::::default(), + BarcodeFormat::DATA_MATRIX => Box::::default(), + BarcodeFormat::AZTEC => Box::::default(), _ => { return Err(Exceptions::IllegalArgumentException(format!( "No encoder available for format {:?}", diff --git a/src/qrcode/qr_code_writer.rs b/src/qrcode/qr_code_writer.rs index ebebf88..472e371 100644 --- a/src/qrcode/qr_code_writer.rs +++ b/src/qrcode/qr_code_writer.rs @@ -32,6 +32,7 @@ const QUIET_ZONE_SIZE: i32 = 4; * * @author dswitkin@google.com (Daniel Switkin) */ +#[derive(Default)] pub struct QRCodeWriter; // { // private static final int QUIET_ZONE_SIZE = 4;