| 1 | use imagerust-analyzer cargo image 0.25.0 crate/::Lumarust-analyzer cargo image 0.25.0 color/Luma#; |
| 2 | use qrcoderust-analyzer cargo qrcode 0.14.1 crate/::QrCoderust-analyzer cargo qrcode 0.14.1 QrCode#; |
| 3 | |
| 4 | fn mainrust-analyzer cargo qrcode 0.14.1 main().() { |
| 5 | // Encode some data into bits. |
| 6 | let code = QrCoderust-analyzer cargo qrcode 0.14.1 QrCode#::newrust-analyzer cargo qrcode 0.14.1 impl#[QrCode]new().(b"01234567").unwraprust-analyzer cargo core https://github.com/rust-lang/rust/library/core result/impl#[`Result<T, E>`]unwrap().(); |
| 7 | |
| 8 | // Render the bits into an image. |
| 9 | let image = code.renderrust-analyzer cargo qrcode 0.14.1 impl#[QrCode]render().::<Lumarust-analyzer cargo image 0.25.0 color/Luma#<u8>>().buildrust-analyzer cargo qrcode 0.14.1 render/impl#[`Renderer<'a, P>`]build().(); |
| 10 | |
| 11 | // Save the image. |
| 12 | image.saverust-analyzer cargo image 0.25.0 buffer_/impl#[`ImageBuffer<P, Container>`]save().("/tmp/qrcode.png").unwraprust-analyzer cargo core https://github.com/rust-lang/rust/library/core result/impl#[`Result<T, E>`]unwrap().(); |
| 13 | } |