port block pair

This commit is contained in:
Henry Schimke
2022-10-01 16:52:58 -05:00
parent b21eb06413
commit a7713b3894
2 changed files with 19 additions and 17 deletions
@@ -14,24 +14,24 @@
* limitations under the License. * limitations under the License.
*/ */
package com.google.zxing.qrcode.encoder; pub struct BlockPair {
data_bytes: Vec<u8>,
error_correction_bytes: Vec<u8>,
}
final class BlockPair { impl BlockPair {
pub fn new(data: Vec<u8>, error_correction: Vec<u8>) -> Self {
private final byte[] dataBytes; Self {
private final byte[] errorCorrectionBytes; data_bytes: data,
error_correction_bytes: error_correction,
BlockPair(byte[] data, byte[] errorCorrection) { }
dataBytes = data;
errorCorrectionBytes = errorCorrection;
} }
public byte[] getDataBytes() { pub fn getDataBytes(&self) -> &[u8] {
return dataBytes; &self.data_bytes
} }
public byte[] getErrorCorrectionBytes() { pub fn getErrorCorrectionBytes(&self) -> &[u8] {
return errorCorrectionBytes; &self.error_correction_bytes
} }
} }
+2
View File
@@ -1,8 +1,10 @@
mod qr_code; mod qr_code;
mod byte_matrix; mod byte_matrix;
mod block_pair;
pub use qr_code::*; pub use qr_code::*;
pub use byte_matrix::*; pub use byte_matrix::*;
pub use block_pair::*;
#[cfg(test)] #[cfg(test)]
mod QRCodeTestCase; mod QRCodeTestCase;