[][src]Crate rqr

A small QR code generation project I made to dip my toes into rust again after several years of absence. I was always curious on how QR codes worked and it was a pretty good project to explore rust with. I followed an excellent tutorial.

This library supports strings encoded in numeric, alphanumeric and byte mode. It supports all versions, meaning different sizes, of a standard QR code with the different error correction levels.

QR code as string output

extern crate rqr;
use rqr::{Qr, StringRenderer};

fn main() {
    let qr = Qr::new("HELLO WORLD").unwrap();
    let s = StringRenderer::new().render(&qr);
    println!("{}", s);

SVG generation

use rqr::{Qr, SvgRenderer, Color, ECLevel};

fn main() {
    let qr = Qr::with_ecl("HELLO WORLD", ECLevel::Q).unwrap();
    let s = SvgRenderer::new()
        .light_module(Color::new(229, 189, 227))
        .dark_module(Color::new(119, 0, 0))
        .dimensions(200, 200)
    println!("{}", s);

Override inferred settings

If not provided the version and encoding modes will be inferred to fit the encoded message. It's possible to override these and others:

use rqr::{QrBuilder, ECLevel, Version, Mask, Mode};

let qr = QrBuilder::new()

More fine grained control is provided by the builder and the underlying matrix.


pub use builder::*;
pub use data::*;
pub use ec::*;
pub use info::*;
pub use mask::*;
pub use matrix::Module;
pub use matrix::Matrix;
pub use mode::Mode;
pub use qr::Qr;
pub use render::*;
pub use version::Version;



QR code builder.


Data encoding.


Error correction calculations.


Contains various QR specific encoding info.


Masking flips data modules with certain patterns.


The matrix holds all modules in a QR code.


Encoding modes for a QR code.


Provides a simple and safe API.


Renders the QR code to different outputs.


Specifies the version of a QR code.