Skip to main content

Crate tuv

Crate tuv 

Source
Expand description

QR code generation library.

Tuv is named for the three letters after QRS in the alphabet — a nod to QR codes and the sequential nature of encoding.

§Quick start

use tuv::QRCode;

let qr = QRCode::from("Hello, world!").generate().unwrap();
let svg = qr.to_svg(true);
let png = qr.to_png(300, true);

§Defaults

With no builder options, QRCode::from auto-selects the smallest Normal QR version and the lowest ECC level (L → M → Q → H) that fit the input. Use QRCodeBuilder::with_ecc or QRCodeBuilder::with_version to fix either field.

§Text vs bytes vs Kanji

QRCode::from accepts UTF-8 strings and encodes them in byte mode (one byte per character code unit). It does not switch to Kanji mode for Japanese text.

True Kanji mode (Shift JIS double-byte characters) requires raw Shift JIS bytes: use QRCode::from_bytes or Bits::push_kanji_data on the low-level Bits API.

§Architecture

Input -> Mode Select -> Reed-Solomon ECC -> Block Interleave
       -> Function Patterns -> Matrix -> Data Placement -> Masking
       -> Format Info -> SVG / PNG

Re-exports§

pub use encoder::Encoder;
pub use encoder::Mode;
pub use error_correction::ECCLevel;
pub use matrix::Module;
pub use matrix::QRMatrix;
pub use types::Color;
pub use types::QRGenError;
pub use types::QrResult;
pub use types::Version;
pub use qrcode::QRCode;
pub use qrcode::QRCodeBuilder;

Modules§

bits
Low-level bit stream API mirroring the reference qrcode crate.
encoder
Encoder module — handles mode selection and data encoding.
error_correction
Error correction module.
matrix
Matrix module — constructs the QR module grid.
micro
Micro QR code encoding (v1–4).
qrcode
Top-level orchestration of the encode pipeline.
render
Rendering — SVG, PNG, unicode, and luma image output.
types
Shared types mirroring the reference qrcode crate API.