add oned to multiformat writer

This commit is contained in:
Henry Schimke
2022-12-13 12:18:00 -06:00
parent 0560a2490b
commit 63252a6297

View File

@@ -17,8 +17,14 @@
use std::collections::HashMap; use std::collections::HashMap;
use crate::{ use crate::{
aztec::AztecWriter, datamatrix::DataMatrixWriter, qrcode::QRCodeWriter, BarcodeFormat, aztec::AztecWriter,
Exceptions, Writer, datamatrix::DataMatrixWriter,
oned::{
Code128Writer, Code39Writer, Code93Writer, EAN13Writer, EAN8Writer, ITFWriter, UPCAWriter,
UPCEWriter,
},
qrcode::QRCodeWriter,
BarcodeFormat, Exceptions, Writer,
}; };
/** /**
@@ -49,27 +55,18 @@ impl Writer for MultiFormatWriter {
hints: &crate::EncodingHintDictionary, hints: &crate::EncodingHintDictionary,
) -> Result<crate::common::BitMatrix, crate::Exceptions> { ) -> Result<crate::common::BitMatrix, crate::Exceptions> {
let writer: Box<dyn Writer> = match format { let writer: Box<dyn Writer> = match format {
BarcodeFormat::EAN_8 => unimplemented!(""), BarcodeFormat::EAN_8 => Box::new(EAN8Writer::default()),
// writer = EAN8Writer(), BarcodeFormat::UPC_E => Box::new(UPCEWriter::default()),
BarcodeFormat::UPC_E => unimplemented!(""), BarcodeFormat::EAN_13 => Box::new(EAN13Writer::default()),
// writer = UPCEWriter(), BarcodeFormat::UPC_A => Box::new(UPCAWriter::default()),
BarcodeFormat::EAN_13 => unimplemented!(""),
// writer = EAN13Writer(),
BarcodeFormat::UPC_A => unimplemented!(""),
// writer = UPCAWriter(),
BarcodeFormat::QR_CODE => Box::new(QRCodeWriter {}), BarcodeFormat::QR_CODE => Box::new(QRCodeWriter {}),
BarcodeFormat::CODE_39 => unimplemented!(""), BarcodeFormat::CODE_39 => Box::new(Code39Writer::default()),
// writer = Code39Writer(), BarcodeFormat::CODE_93 => Box::new(Code93Writer::default()),
BarcodeFormat::CODE_93 => unimplemented!(""), BarcodeFormat::CODE_128 => Box::new(Code128Writer::default()),
// writer = Code93Writer(), BarcodeFormat::ITF => Box::new(ITFWriter::default()),
BarcodeFormat::CODE_128 => unimplemented!(""),
// writer = Code128Writer(),
BarcodeFormat::ITF => unimplemented!(""),
// writer = ITFWriter(),
BarcodeFormat::PDF_417 => unimplemented!(""), BarcodeFormat::PDF_417 => unimplemented!(""),
// writer = PDF417Writer(), // Box::new(PDF417Writer::default()),
BarcodeFormat::CODABAR => unimplemented!(""), BarcodeFormat::CODABAR => Box::new(Code128Writer::default()),
// writer = CodaBarWriter(),
BarcodeFormat::DATA_MATRIX => Box::new(DataMatrixWriter {}), BarcodeFormat::DATA_MATRIX => Box::new(DataMatrixWriter {}),
BarcodeFormat::AZTEC => Box::new(AztecWriter {}), BarcodeFormat::AZTEC => Box::new(AztecWriter {}),
_ => { _ => {