Expand description
The qrcode2 crate is a QR code encoding library.
This crate provides a normal QR code, Micro QR code, and rMQR code encoder for binary data.
§Examples
use qrcode2::{QrCode, 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.
let temp_dir = tempfile::tempdir().unwrap();
image.save(temp_dir.path().join("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 crate::types::Color;pub use crate::types::EcLevel;pub use crate::types::QrError;pub use crate::types::QrResult;pub use crate::types::Version;pub use image;image
Modules§
- bits
- The
bitsmodule encodes binary data into raw bits used in a QR code. - canvas
- The
canvasmodule puts raw bits into the QR code canvas. - ec
- The
ecmodule applies the Reed-Solomon error correction codes. - optimize
- Find the optimal data mode sequence to encode a piece of data.
- render
- Render a QR code into image.
- types
- The
typesmodule contains types associated with the functional elements of a QR code.
Structs§
- QrCode
- The encoded QR code symbol.