Expand description
Bit-level data encoding for QR codes.
This module handles the conversion of raw input data into the bit stream that gets placed onto the QR code canvas. It supports all four data modes:
- Numeric — digits 0-9 (most efficient)
- Alphanumeric — uppercase letters, digits, and a few symbols
- Byte — arbitrary 8-bit data (including UTF-8)
- Kanji — Shift JIS encoded double-byte characters
The Bits struct is the main entry point. Use encode_auto or
encode_auto_micro for automatic version and mode selection, or
construct a Bits manually for advanced use cases like ECI designators
or FNC1 patterns.
Structs§
- Bits
- The
Bitsstructure stores the encoded data for a QR code.
Enums§
- Extended
Mode - An “extended” mode indicator, includes all indicators supported by QR code beyond those bearing data.
Functions§
- data_
capacity_ bits - Returns the data capacity (in bits) for the given version and error correction level — the maximum number of data bits a symbol of that version can hold.
- encode_
auto - Automatically determines the minimum version to store the data, and encode the result.
- encode_
auto_ micro - Automatically determines the minimum Micro QR version to store the data, and encode the result.
- find_
min_ version - Finds the smallest version (QR code only) that can store N bits of data in the given error correction level.