Skip to main content

Crate qrcode_rs

Crate qrcode_rs 

Source
Expand description

QRCode encoder

This crate provides a QR code and Micro QR code encoder for binary data.

use qrcode_rs::QrCode;
use image::Luma;

// Encode some data into bits.
let code = QrCode::new(b"01234567").unwrap();

// Render the bits into an image.
let image = code.render::<Luma<u8>>().build();

// Save the image.
image.save("/tmp/qrcode.png").unwrap();

// You can also render it into a string.
let string = code.render()
    .light_color(' ')
    .dark_color('#')
    .build();
println!("{}", string);

Re-exports§

pub use qrcode_decode as decode;
pub use qrcode_parse as parse;

Modules§

bits
Bit-level data encoding for QR codes.
canvas
QR code canvas construction and masking.
ec
Reed-Solomon error correction for QR codes.
optimize
Data mode segmentation optimizer.
plugin
Explicit plugin registry and object-safe extension points.
render
Rendering facade.
structured_append
ISO/IEC 18004 §7.4 Structured Append — splitting one payload across 2..=16 QR symbols.
traits
Core extension traits for encoding, rendering, and module-grid storage.
types
Core data types: module Color, EcLevel, Version, Mode, the QrError / QrResult error types, and string-parsing helpers.

Structs§

AlphanumericMode
Type-level alphanumeric mode marker.
Analysis
Diagnostic stats for a constructed QrCode, returned by QrCode::analyze.
AutoEncoder
Encoder adapter for automatically sized normal QR codes.
ByteMode
Type-level byte mode marker.
ConstVersion
A compile-time checked normal QR version.
ConstVersionEncoder
Encoder adapter for a compile-time checked normal QR version and EcLevel.
DarkModules
Iterator over the (x, y) coordinates of every dark module in a QrCode, created by QrCode::dark_modules.
EncodeConfig
Runtime encoder configuration passed to encoder factories.
Info
Metadata about a constructed QrCode, returned by QrCode::info.
KanjiMode
Type-level Shift-JIS Kanji mode marker.
MicroEncoder
Encoder adapter for automatically sized Micro QR codes.
ModuleGrid
Owned mutable module grid used by plugin postprocessors.
ModuleView
Borrowed row-major view over a read-only QR module grid.
NumericMode
Type-level numeric mode marker.
PluginRegistry
Explicit plugin registry.
QrCode
The encoded QR code symbol.
QrCodeBuilder
A builder for QrCode, offering ergonomic, chainable configuration.
QrCodeDataserde
A serializable view of a QrCode (matrix + metadata), enabled by the serde feature. Round-trips via QrCode::to_serializable and QrCode::from_serializable.
QrCodePlugins
Borrowed plugin view for a QR code.
QrCodeRef
Borrowed QR symbol with module-grid data and QR metadata.
QrCodeStream
Lazy iterator returned by QrCode::stream and QrCode::stream_with_error_correction_level.
QrTemplate
A reusable render-time style: dark/light hex colors, module size, and quiet zone. Apply to a Renderer with Renderer::template when the pixel type is a StyledPixel.
RenderConfig
Runtime renderer configuration passed to renderer factories.
Row
A single row of modules, yielded by Rows. Iterates over Colors from left to right (quiet zone excluded).
Rows
Iterator over the rows of a QrCode, created by QrCode::rows.
VersionEncoder
Encoder adapter for a pinned Version and EcLevel.

Enums§

Color
The color of a module.
EcLevel
The error correction level. It allows the original information be recovered even if parts of the code is damaged.
EncodedOutput
Type-erased encode output returned by dynamic encoders.
Mode
The mode indicator, which specifies the character set of the encoded data.
PluginError
Error type used by object-safe plugin entry points.
QrError
QrError encodes the error encountered when generating a QR code.
RenderOutput
Type-erased render output returned by dynamic renderers.
Version
In QR code terminology, Version means the size of the generated image. Larger version means the size of code is larger, and therefore can carry more information.

Traits§

Builder
Builds a configured value into its final output.
CoreRenderer
Renders a module-grid source into a concrete output type.
DynEncoder
Object-safe encoder used by EncoderFactory.
DynRenderer
Object-safe renderer used by RendererFactory.
Encoder
Encodes raw input bytes into a concrete output type.
EncoderFactory
Factory for object-safe encoders.
EncodingMode
A type-level QR encoding mode.
ModuleSource
Read-only access to a QR module grid.
ModuleStorage
Read/write access to a QR module grid.
PostProcessor
Object-safe postprocessor for in-place module-grid transforms.
QrPlugin
A plugin that registers one or more extension points.
QrSymbol
Read-only QR symbol metadata plus module-grid access.
RendererFactory
Factory for object-safe renderers.
StaticVersion
A type-level fixed QR version.

Type Aliases§

QrResult
QrResult is a convenient alias for a QR code generation result.