Crate zbar_pack

Crate zbar_pack 

Source
Expand description

Safe Rust bindings for ZBar barcode scanner library

This crate provides a safe Rust wrapper around the ZBar C library, with static linking of vendored ZBar source code by default.

§Features

  • vendored (default): Compile and statically link bundled ZBar source
  • system: Use system-installed ZBar library
  • dynamic: Dynamically link system ZBar library
  • all-codecs (default): Enable all codecs
  • minimal: Minimal build, manually enable required codecs

§License Compliance

ZBar is licensed under LGPLv2.1+. When statically linking, this project must:

  • Provide complete ZBar source code and build instructions (see zbar-src/)
  • Allow end users to replace/relink the library
  • See COMPLIANCE.md for details

§Example

use zbar_pack::{ImageScanner, Image, SymbolType};

let mut scanner = ImageScanner::new()?;
scanner.set_config(SymbolType::QRCODE, 0, 1)?;

// Example: 100x100 grayscale image
let data: Vec<u8> = vec![0; 100 * 100];
let image = Image::from_gray(&data, 100, 100)?;
let symbols = scanner.scan_image(&image)?;

for symbol in symbols {
    println!("Type: {:?}, Data: {}", symbol.symbol_type(), symbol.data());
}

Structs§

Image
Image object
ImageScanner
Image scanner
Symbol
Scanned symbol
SymbolIter
Symbol iterator

Enums§

Error
ZBar error types
SymbolType
Symbol types (barcode/QR code types)

Functions§

set_verbosity
Set global library debug/verbosity level
version
Get ZBar version information

Type Aliases§

Result