Skip to main content

construct_codewords

Function construct_codewords 

Source
pub fn construct_codewords(
    rawbits: &[u8],
    version: Version,
    ec_level: EcLevel,
) -> QrResult<(Vec<u8>, Vec<u8>)>
Expand description

Constructs data and error correction codewords ready to be put in the QR code matrix.

§Errors

Returns Err(QrError::InvalidVersion) if it is not valid to use the ec_level for the given version (e.g. Version::Micro(1) with EcLevel::H).

Returns QrError::InvalidDataLength if rawbits does not contain exactly the padded data bytes required by this version and correction level. For Micro M1 and M3, this includes the byte containing the final half codeword.