qrcode-rust/README.md

54 lines
1.3 KiB
Markdown
Raw Normal View History

2014-08-18 16:27:17 -05:00
qrcode-rust
===========
[![Build status](https://travis-ci.org/kennytm/qrcode-rust.svg?branch=master)](https://travis-ci.org/kennytm/qrcode-rust)
2016-05-14 10:43:38 -05:00
[![Coverage Status](https://coveralls.io/repos/github/kennytm/qrcode-rust/badge.svg?branch=coveralls)](https://coveralls.io/github/kennytm/qrcode-rust?branch=coveralls)
[![crates.io](http://meritbadge.herokuapp.com/qrcode)](https://crates.io/crates/qrcode)
[![MIT / Apache 2.0](https://img.shields.io/badge/license-MIT%20%2f%20Apache%202.0-blue.svg)](./LICENSE-APACHE.txt)
2014-08-18 16:27:17 -05:00
2016-06-07 11:31:11 -05:00
QR code and Micro QR code encoder in Rust. [Documentation](https://kennytm.github.io/qrcode-rust).
Cargo.toml
----------
```toml
[dependencies]
qrcode = "0.2.0"
```
The default settings will depend on the `image` crate. If you don't need image generation capability, disable the `default-features`:
2014-08-18 16:27:17 -05:00
```toml
2016-05-14 10:43:38 -05:00
[dependencies]
2016-06-07 11:31:11 -05:00
qrcode = { version = "0.2.0", default-features = false }
2014-08-18 16:27:17 -05:00
```
2016-06-07 11:31:11 -05:00
Example
-------
This code:
```rust
extern crate qrcode;
extern crate image;
use qrcode::QrCode;
use image::GrayImage;
fn main() {
// Encode some data into bits.
let code = QrCode::new(b"01234567").unwrap();
// Render the bits into an image.
let image: GrayImage = code.render().to_image();
// Save the image.
image.save("/tmp/qrcode.png").unwrap();
}
```
Generates this image:
![Output](src/test_annex_i_qr_as_image.png)
2014-08-18 16:27:17 -05:00