diff --git a/Cargo.toml b/Cargo.toml index 71f919f..5f6526e 100644 --- a/Cargo.toml +++ b/Cargo.toml @@ -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"] diff --git a/README.md b/README.md index 9204909..60db9e7 100644 --- a/README.md +++ b/README.md @@ -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). diff --git a/src/lib.rs b/src/lib.rs index c7678a6..006a1e8 100644 --- a/src/lib.rs +++ b/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