pub fn generate(
barcode_type: BarcodeType,
data: &str,
format: ExportFormat,
) -> Result<Vec<u8>>Expand description
Main generation function - unified API for all barcode types
§Arguments
barcode_type- The type of barcode to generatedata- The data to encodeformat- The output format (PNG, SVG)
§Returns
Returns the generated barcode as bytes in the specified format
§Examples
use quickcodes::{generate, BarcodeType, ExportFormat};
fn main() -> Result<(), Box<dyn std::error::Error>> {
// Generate QR Code as SVG
let svg_data = generate(BarcodeType::QRCode, "https://example.com", ExportFormat::SVG)?;
// Generate EAN-13 as PNG
let png_data = generate(BarcodeType::EAN13, "123456789012", ExportFormat::PNG)?;
Ok(())
}