DEWQ

Function create_qr_code

Source
pub fn create_qr_code(
    data: &str,
    error_correction_level: ErrorCorrectionLevel,
) -> BitMap
Expand description

Creates a QR code bitmap from input data with specified error correction

This function generates a complete QR code bitmap by performing the following steps:

  1. Analyze the input data to determine the appropriate encoding mode
  2. Encode the data into a bitstring
  3. Generate error correction codes
  4. Structure the data and error correction codewords
  5. Create the final QR code bitmap

§Arguments

  • data - The string data to be encoded in the QR code
  • error_correction_level - The error correction level for redundancy and recovery

§Returns

A BitMap representing the fully generated QR code

§Errors

Panics if the data cannot be encoded or exceeds QR code capacity

§Examples

use qr_code::{create_qr_code, ErrorCorrectionLevel};

let qr_code = create_qr_code("HELLO, WORLD!", ErrorCorrectionLevel::Q);

§Performance

The function’s complexity depends on the data length and chosen error correction level