Crates.io | qrcodegen |
lib.rs | qrcodegen |
version | 1.8.0 |
source | src |
created_at | 2017-09-06 18:27:33.951944 |
updated_at | 2022-04-17 04:30:08.593991 |
description | High-quality QR Code generator library |
homepage | https://www.nayuki.io/page/qr-code-generator-library |
repository | https://github.com/nayuki/QR-Code-generator |
max_upload_size | |
id | 30824 |
size | 49,996 |
This project aims to be the best, clearest QR Code generator library. The primary goals are flexible options and absolute correctness. Secondary goals are compact implementation size and good documentation comments.
Home page with live JavaScript demo, extensive descriptions, and competitor comparisons: https://www.nayuki.io/page/qr-code-generator-library
Core features:
Manual parameters:
More information about QR Code technology and this library's design can be found on the project home page.
extern crate qrcodegen;
use qrcodegen::Mask;
use qrcodegen::QrCode;
use qrcodegen::QrCodeEcc;
use qrcodegen::QrSegment;
use qrcodegen::Version;
// Simple operation
let qr = QrCode::encode_text("Hello, world!",
QrCodeEcc::Medium).unwrap();
let svg = to_svg_string(&qr, 4); // See qrcodegen-demo
// Manual operation
let text: &str = "3141592653589793238462643383";
let segs = QrSegment::make_segments(text);
let qr = QrCode::encode_segments_advanced(&segs,
QrCodeEcc::High, Version::new(5), Version::new(5),
Some(Mask::new(2)), false).unwrap();
for y in 0 .. qr.size() {
for x in 0 .. qr.size() {
(... paint qr.get_module(x, y) ...)
}
}
More complete set of examples: https://github.com/nayuki/QR-Code-generator/blob/master/rust/examples/qrcodegen-demo.rs .