Closed orar closed 1 year ago
Implement the std::error::Error trait for ImageError to enable easy error handling;
std::error::Error
ImageError
fn gen_qr_code(input: &str) -> Result<Vec<u8>, Box<dyn std::error::Error>> { let qr = QRBuilder::new(input).build()?; let img = ImageBuilder::default() .shape(Shape::RoundedSquare) .background_color([255, 255, 255, 0]) .fit_width(600) .to_bytes(&qr)?; Ok(img) }
Hey thanks!
Implement the
std::error::Error
trait forImageError
to enable easy error handling;