generate_qr_string

Function generate_qr_string 

Source
pub fn generate_qr_string<T: Serialize>(
    data: &T,
    options: &QrOptions,
) -> QrResult<String>
Expand description

Generate a QR code and return the visual representation as a string from structured data

This function creates a QR code from structured data using postcard serialization and returns it as a string that can be printed to the console.

§Arguments

  • data - The data to encode (must implement Serialize)
  • options - Display options for the QR code

§Returns

  • QrResult<String> - The QR code as a printable string

§Examples

use zoe_app_primitives::qr::{generate_qr_string, QrOptions};
use serde::Serialize;

#[derive(Serialize)]
struct MyData {
    message: String,
}

let data = MyData { message: "Hello, World!".to_string() };
let options = QrOptions::new("My QR Code").with_footer("Scan me!");
let qr_string = generate_qr_string(&data, &options).unwrap();
println!("{}", qr_string);