Incorporate README example directly into doc test.
This commit is contained in:
parent
1d5d6f2883
commit
c960c09662
|
@ -12,9 +12,12 @@ exclude = [
|
|||
".travis.yml", ".gitignore", "test-data"
|
||||
]
|
||||
|
||||
[badges]
|
||||
travis-ci = { repository = "kennytm/qrcode-rust" }
|
||||
|
||||
[dependencies]
|
||||
num-traits = "0.1.33"
|
||||
image = { version = "0.12.1", optional = true }
|
||||
image = { version = "0.12.2", optional = true }
|
||||
|
||||
[features]
|
||||
default = ["image"]
|
||||
|
|
|
@ -3,7 +3,7 @@ qrcode-rust
|
|||
|
||||
[![Build status](https://travis-ci.org/kennytm/qrcode-rust.svg?branch=master)](https://travis-ci.org/kennytm/qrcode-rust)
|
||||
[![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)
|
||||
[![crates.io](https://img.shields.io/crates/v/qrcode.svg)](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)
|
||||
|
||||
QR code and Micro QR code encoder in Rust. [Documentation](https://docs.rs/qrcode).
|
||||
|
|
23
src/lib.rs
23
src/lib.rs
|
@ -3,26 +3,23 @@
|
|||
//! This crate provides a QR code and Micro QR code encoder for binary data.
|
||||
//!
|
||||
//! ```
|
||||
//! extern crate image;
|
||||
//! extern crate qrcode;
|
||||
//! extern crate image;
|
||||
//!
|
||||
//! use image::GrayImage;
|
||||
//! use qrcode::QrCode;
|
||||
//! use image::GrayImage;
|
||||
//!
|
||||
//! # fn main() {
|
||||
//! fn main() {
|
||||
//! // Encode some data into bits.
|
||||
//! let code = QrCode::new(b"01234567").unwrap();
|
||||
//!
|
||||
//! let code = QrCode::new(b"Some content here.");
|
||||
//! match code {
|
||||
//! Err(err) => panic!("Failed to encode the QR code: {:?}", err),
|
||||
//! Ok(code) => {
|
||||
//! let image: GrayImage = code.render().min_width(100).to_image();
|
||||
//! // render `image`...
|
||||
//! }
|
||||
//! // Render the bits into an image.
|
||||
//! let image: GrayImage = code.render().to_image();
|
||||
//!
|
||||
//! // Save the image.
|
||||
//! image.save("/tmp/qrcode.png").unwrap();
|
||||
//! }
|
||||
//!
|
||||
//! # }
|
||||
//! ```
|
||||
//!
|
||||
|
||||
#![cfg_attr(feature="bench", feature(test))] // Unstable libraries
|
||||
|
||||
|
|
Loading…
Reference in a new issue