Remove stability attributes.

This commit is contained in:
kennytm 2015-04-26 23:47:27 +08:00
parent 6ebf629ba4
commit fd0acd12ee
6 changed files with 26 additions and 25 deletions

View file

@ -2,7 +2,7 @@
name = "qrcode" name = "qrcode"
description = "QR code encoder in Rust" description = "QR code encoder in Rust"
license = "Apache-2.0" license = "Apache-2.0"
version = "0.1.4" version = "0.1.5"
authors = ["kennytm <kennytm@gmail.com>"] authors = ["kennytm <kennytm@gmail.com>"]
keywords = ["qrcode"] keywords = ["qrcode"]
repository = "https://github.com/kennytm/qrcode-rust" repository = "https://github.com/kennytm/qrcode-rust"
@ -12,3 +12,5 @@ documentation = "http://www.rust-ci.org/kennytm/qrcode-rust/doc/qrcode/index.htm
[dependencies] [dependencies]
num = "*" num = "*"
[[bin]]
name = "qrencode"

23
src/bin/qrencode.rs Normal file
View file

@ -0,0 +1,23 @@
extern crate qrcode;
use std::env;
const SPACE: char = ' '; //' ';
pub fn main() {
let arg = env::args().nth(1).unwrap();
let code = qrcode::QrCode::new(arg.as_bytes()).unwrap();
print!("\n\n\n\n\n{}{}{}{}{}", SPACE, SPACE, SPACE, SPACE, SPACE);
for y in 0 .. code.width() {
for x in 0 .. code.width() {
let block = if code[(x, y)] { '█' } else { SPACE };
print!("{}{}", block, block);
}
print!("\n{}{}{}{}{}", SPACE, SPACE, SPACE, SPACE, SPACE);
}
println!("\n\n\n\n");
}

View file

@ -1,5 +1,3 @@
#![unstable]
//! The `bits` module encodes binary data into raw bits used in a QR code. //! The `bits` module encodes binary data into raw bits used in a QR code.
use std::cmp::min; use std::cmp::min;
@ -165,7 +163,6 @@ impl Bits {
/// ///
/// If the mode is not supported in the provided version, this method /// If the mode is not supported in the provided version, this method
/// returns `Err(QrError::UnsupportedCharacterSet)`. /// returns `Err(QrError::UnsupportedCharacterSet)`.
#[unstable]
pub fn push_mode_indicator(&mut self, mode: ExtendedMode) -> QrResult<()> { pub fn push_mode_indicator(&mut self, mode: ExtendedMode) -> QrResult<()> {
let number = match (self.version, mode) { let number = match (self.version, mode) {
(Version::Micro(1), ExtendedMode::Data(Mode::Numeric)) => return Ok(()), (Version::Micro(1), ExtendedMode::Data(Mode::Numeric)) => return Ok(()),
@ -308,7 +305,6 @@ impl Bits {
/// Encodes a numeric string to the bits. /// Encodes a numeric string to the bits.
/// ///
/// The data should only contain the characters 0 to 9. /// The data should only contain the characters 0 to 9.
#[unstable]
pub fn push_numeric_data(&mut self, data: &[u8]) -> QrResult<()> { pub fn push_numeric_data(&mut self, data: &[u8]) -> QrResult<()> {
try!(self.push_header(Mode::Numeric, data.len())); try!(self.push_header(Mode::Numeric, data.len()));
for chunk in data.chunks(3) { for chunk in data.chunks(3) {
@ -405,7 +401,6 @@ impl Bits {
/// ///
/// The data should only contain the charaters A to Z (excluding lowercase), /// The data should only contain the charaters A to Z (excluding lowercase),
/// 0 to 9, space, `$`, `%`, `*`, `+`, `-`, `.`, `/` or `:`. /// 0 to 9, space, `$`, `%`, `*`, `+`, `-`, `.`, `/` or `:`.
#[unstable]
pub fn push_alphanumeric_data(&mut self, data: &[u8]) -> QrResult<()> { pub fn push_alphanumeric_data(&mut self, data: &[u8]) -> QrResult<()> {
try!(self.push_header(Mode::Alphanumeric, data.len())); try!(self.push_header(Mode::Alphanumeric, data.len()));
for chunk in data.chunks(2) { for chunk in data.chunks(2) {
@ -453,7 +448,6 @@ mod alphanumeric_tests {
impl Bits { impl Bits {
/// Encodes 8-bit byte data to the bits. /// Encodes 8-bit byte data to the bits.
#[unstable]
pub fn push_byte_data(&mut self, data: &[u8]) -> QrResult<()> { pub fn push_byte_data(&mut self, data: &[u8]) -> QrResult<()> {
try!(self.push_header(Mode::Byte, data.len())); try!(self.push_header(Mode::Byte, data.len()));
for b in data { for b in data {
@ -503,7 +497,6 @@ mod byte_tests {
impl Bits { impl Bits {
/// Encodes Shift JIS double-byte data to the bits. /// Encodes Shift JIS double-byte data to the bits.
#[unstable]
pub fn push_kanji_data(&mut self, data: &[u8]) -> QrResult<()> { pub fn push_kanji_data(&mut self, data: &[u8]) -> QrResult<()> {
try!(self.push_header(Mode::Kanji, data.len()/2)); try!(self.push_header(Mode::Kanji, data.len()/2));
for kanji in data.chunks(2) { for kanji in data.chunks(2) {
@ -656,7 +649,6 @@ static DATA_LENGTHS: [[usize; 4]; 44] = [
impl Bits { impl Bits {
/// Pushes the ending bits to indicate no more data. /// Pushes the ending bits to indicate no more data.
#[unstable]
pub fn push_terminator(&mut self, ec_level: EcLevel) -> QrResult<()> { pub fn push_terminator(&mut self, ec_level: EcLevel) -> QrResult<()> {
let terminator_size = match self.version { let terminator_size = match self.version {
Version::Micro(a) => (a as usize) * 2 + 1, Version::Micro(a) => (a as usize) * 2 + 1,
@ -842,7 +834,6 @@ pub fn encode_auto(data: &[u8], ec_level: EcLevel) -> QrResult<Bits> {
/// Finds the smallest version (QR code only) that can store N bits of data /// Finds the smallest version (QR code only) that can store N bits of data
/// in the given error correction level. /// in the given error correction level.
#[unstable]
fn find_min_version(length: usize, ec_level: EcLevel) -> Version { fn find_min_version(length: usize, ec_level: EcLevel) -> Version {
let mut min = 0; let mut min = 0;
let mut max = 39; let mut max = 39;

View file

@ -18,7 +18,6 @@
//! } //! }
//! //!
#![unstable]
#![cfg_attr(test, feature(test))] // Unstable libraries #![cfg_attr(test, feature(test))] // Unstable libraries
#[cfg(test)] #[cfg(test)]

View file

@ -1,5 +1,3 @@
#![unstable]
//! Find the optimal data mode sequence to encode a piece of data. //! Find the optimal data mode sequence to encode a piece of data.
use std::slice::Iter; use std::slice::Iter;
use types::{Mode, Version}; use types::{Mode, Version};

View file

@ -1,5 +1,3 @@
#![unstable]
use std::default::Default; use std::default::Default;
use std::cmp::{PartialOrd, Ordering}; use std::cmp::{PartialOrd, Ordering};
use std::fmt::{Display, Formatter, Error}; use std::fmt::{Display, Formatter, Error};
@ -8,7 +6,6 @@ use std::fmt::{Display, Formatter, Error};
//{{{ QrResult //{{{ QrResult
/// `QrError` encodes the error encountered when generating a QR code. /// `QrError` encodes the error encountered when generating a QR code.
#[unstable]
#[derive(Debug, PartialEq, Eq, Copy, Clone)] #[derive(Debug, PartialEq, Eq, Copy, Clone)]
pub enum QrError { pub enum QrError {
/// The data is too long to encode into a QR code for the given version. /// The data is too long to encode into a QR code for the given version.
@ -43,7 +40,6 @@ impl Display for QrError {
} }
/// `QrResult` is a convenient alias for a QR code generation result. /// `QrResult` is a convenient alias for a QR code generation result.
#[stable]
pub type QrResult<T> = Result<T, QrError>; pub type QrResult<T> = Result<T, QrError>;
//}}} //}}}
@ -53,7 +49,6 @@ pub type QrResult<T> = Result<T, QrError>;
/// The error correction level. It allows the original information be recovered /// The error correction level. It allows the original information be recovered
/// even if parts of the code is damaged. /// even if parts of the code is damaged.
#[derive(Debug, PartialEq, Eq, Copy, Clone, PartialOrd, Ord)] #[derive(Debug, PartialEq, Eq, Copy, Clone, PartialOrd, Ord)]
#[unstable]
pub enum EcLevel { pub enum EcLevel {
/// Low error correction. Allows up to 7% of wrong blocks. /// Low error correction. Allows up to 7% of wrong blocks.
L = 0, L = 0,
@ -78,7 +73,6 @@ pub enum EcLevel {
/// ///
/// The smallest version is `Version::Normal(1)` of size 21×21, and the largest /// The smallest version is `Version::Normal(1)` of size 21×21, and the largest
/// is `Version::Normal(40)` of size 177×177. /// is `Version::Normal(40)` of size 177×177.
#[unstable]
#[derive(Debug, PartialEq, Eq, Copy, Clone)] #[derive(Debug, PartialEq, Eq, Copy, Clone)]
pub enum Version { pub enum Version {
/// A normal QR code version. The parameter should be between 1 and 40. /// A normal QR code version. The parameter should be between 1 and 40.
@ -91,7 +85,6 @@ pub enum Version {
impl Version { impl Version {
/// Get the number of "modules" on each size of the QR code, i.e. the width /// Get the number of "modules" on each size of the QR code, i.e. the width
/// and height of the code. /// and height of the code.
#[unstable]
pub fn width(&self) -> i16 { pub fn width(&self) -> i16 {
match *self { match *self {
Version::Normal(v) => v * 4 + 17, Version::Normal(v) => v * 4 + 17,
@ -127,7 +120,6 @@ impl Version {
} }
/// The number of bits needed to encode the mode indicator. /// The number of bits needed to encode the mode indicator.
#[unstable]
pub fn mode_bits_count(&self) -> usize { pub fn mode_bits_count(&self) -> usize {
match *self { match *self {
Version::Micro(a) => (a - 1) as usize, Version::Micro(a) => (a - 1) as usize,
@ -136,7 +128,6 @@ impl Version {
} }
/// Checks whether is version refers to a Micro QR code. /// Checks whether is version refers to a Micro QR code.
#[unstable]
pub fn is_micro(&self) -> bool { pub fn is_micro(&self) -> bool {
match *self { match *self {
Version::Normal(_) => false, Version::Normal(_) => false,
@ -151,7 +142,6 @@ impl Version {
//{{{ Mode indicator //{{{ Mode indicator
/// The mode indicator, which specifies the character set of the encoded data. /// The mode indicator, which specifies the character set of the encoded data.
#[unstable]
#[derive(Debug, PartialEq, Eq, Copy, Clone)] #[derive(Debug, PartialEq, Eq, Copy, Clone)]
pub enum Mode { pub enum Mode {
/// The data contains only characters 0 to 9. /// The data contains only characters 0 to 9.
@ -177,7 +167,6 @@ impl Mode {
/// ///
/// This method will return `Err(QrError::UnsupportedCharacterSet)` if the /// This method will return `Err(QrError::UnsupportedCharacterSet)` if the
/// mode is not supported in the given version. /// mode is not supported in the given version.
#[unstable]
pub fn length_bits_count(&self, version: Version) -> usize { pub fn length_bits_count(&self, version: Version) -> usize {
match version { match version {
Version::Micro(a) => { Version::Micro(a) => {
@ -217,7 +206,6 @@ impl Mode {
/// ///
/// Note that in Kanji mode, the `raw_data_len` is the number of Kanjis, /// Note that in Kanji mode, the `raw_data_len` is the number of Kanjis,
/// i.e. half the total size of bytes. /// i.e. half the total size of bytes.
#[unstable]
pub fn data_bits_count(&self, raw_data_len: usize) -> usize { pub fn data_bits_count(&self, raw_data_len: usize) -> usize {
match *self { match *self {
Mode::Numeric => (raw_data_len * 10 + 2) / 3, Mode::Numeric => (raw_data_len * 10 + 2) / 3,