diff --git a/src/qrcode/encoder/BlockPair.java b/src/qrcode/encoder/block_pair.rs similarity index 57% rename from src/qrcode/encoder/BlockPair.java rename to src/qrcode/encoder/block_pair.rs index 5714d9c..d83b102 100644 --- a/src/qrcode/encoder/BlockPair.java +++ b/src/qrcode/encoder/block_pair.rs @@ -14,24 +14,24 @@ * limitations under the License. */ -package com.google.zxing.qrcode.encoder; - -final class BlockPair { - - private final byte[] dataBytes; - private final byte[] errorCorrectionBytes; - - BlockPair(byte[] data, byte[] errorCorrection) { - dataBytes = data; - errorCorrectionBytes = errorCorrection; - } - - public byte[] getDataBytes() { - return dataBytes; - } - - public byte[] getErrorCorrectionBytes() { - return errorCorrectionBytes; - } - +pub struct BlockPair { + data_bytes: Vec, + error_correction_bytes: Vec, +} + +impl BlockPair { + pub fn new(data: Vec, error_correction: Vec) -> Self { + Self { + data_bytes: data, + error_correction_bytes: error_correction, + } + } + + pub fn getDataBytes(&self) -> &[u8] { + &self.data_bytes + } + + pub fn getErrorCorrectionBytes(&self) -> &[u8] { + &self.error_correction_bytes + } } diff --git a/src/qrcode/encoder/mod.rs b/src/qrcode/encoder/mod.rs index 3337fcc..77379e1 100644 --- a/src/qrcode/encoder/mod.rs +++ b/src/qrcode/encoder/mod.rs @@ -1,8 +1,10 @@ mod qr_code; mod byte_matrix; +mod block_pair; pub use qr_code::*; pub use byte_matrix::*; +pub use block_pair::*; #[cfg(test)] mod QRCodeTestCase;