diff --git a/.travis.yml b/.travis.yml index ff35dff..18d6a93 100644 --- a/.travis.yml +++ b/.travis.yml @@ -2,7 +2,7 @@ language: rust env: FEATURES="" matrix: include: - - rust: 1.17.0 + - rust: 1.26.0 - rust: stable - rust: beta - rust: nightly diff --git a/Cargo.toml b/Cargo.toml index dd6ee66..d42dd12 100644 --- a/Cargo.toml +++ b/Cargo.toml @@ -1,6 +1,6 @@ [package] name = "signifix" -version = "0.8.0" +version = "0.9.0" authors = [ "Rouven Spreckels ", ] diff --git a/README.md b/README.md index 31ff63c..e9e2219 100644 --- a/README.md +++ b/README.md @@ -14,7 +14,7 @@ [Documentation]: https://docs.rs/signifix/badge.svg [License]: https://img.shields.io/crates/l/signifix.svg -**Works now on stable Rust** +**Works now on stable Rust (>= 1.26.0)** Formats a given number in one of the three Signifix notations [as defined below](#signifix-notations) by determining @@ -92,9 +92,9 @@ used by adding `signifix` to the dependencies in your project's ```toml [dependencies] -signifix = "0.8" +signifix = "0.9" -# Optionally enable `try_from` and `i128_type` support on nightly Rust. +# Optionally enable `try_from` support on nightly Rust. #[dependencies.signifix] #features = ["nightly"] ``` @@ -102,9 +102,9 @@ signifix = "0.8" and this to your crate root: ```rust -// Optionally enable `try_from` and `i128_type` support on nightly Rust. +// Optionally enable `try_from` support on nightly Rust. // Required if the `nightly` feature is enabled in your `Cargo.toml`. -//#![feature(try_from, i128_type)] +//#![feature(try_from)] extern crate signifix; ``` diff --git a/RELEASES.md b/RELEASES.md index 4dc2350..fd7db7b 100644 --- a/RELEASES.md +++ b/RELEASES.md @@ -1,3 +1,7 @@ +# Version 0.9.0 (2018-05-10) + + * Added stable `i128_type` support requiring Rust `>= 1.26.0`. + # Version 0.8.0 (2017-11-26) * Works now on stable Rust by reimplementing the `try_from` feature. diff --git a/src/binary.rs b/src/binary.rs index bc1a958..0d691c4 100644 --- a/src/binary.rs +++ b/src/binary.rs @@ -1,4 +1,4 @@ -// Copyright (c) 2016, 2017 Rouven Spreckels +// Copyright (c) 2016, 2017, 2018 Rouven Spreckels // // Usage of the works is permitted provided that // this instrument is retained with the works, so that @@ -102,7 +102,6 @@ pub const SYMBOLS: [Option<&str>; 9] = [ Some("Pi"), Some("Ei"), Some("Zi"), Some("Yi"), ]; -#[cfg(feature = "nightly")] /// Binary prefix factors from `1 024 ^ 1` to `1 024 ^ 8` indexed from `1` to /// `8`, or `1 024 ^ 0` indexed at `0`. pub const FACTORS: [f64; 9] = [ @@ -113,21 +112,6 @@ pub const FACTORS: [f64; 9] = [ (1u128 << 70) as f64, (1u128 << 80) as f64, ]; -#[cfg(not(feature = "nightly"))] -/// Binary prefix factors from `1 024 ^ 1` to `1 024 ^ 8` indexed from `1` to -/// `8`, or `1 024 ^ 0` indexed at `0`. -pub const FACTORS: [f64; 9] = [ - 1f64, - 1024f64, - 1048576f64, - 1073741824f64, - 1099511627776f64, - 1125899906842624f64, - 1152921504606847000f64, - 1180591620717411300000f64, - 1208925819614629200000000f64, -]; - impl Signifix { /// Signed significand normalized from `±1.000` over `±999.9` to `±1 023`. pub fn significand(&self) -> f64 { @@ -215,16 +199,9 @@ impl Display for Signifix { } } -#[cfg(feature = "nightly")] try_from! { i8, i16, i32, i64, i128, isize } -#[cfg(feature = "nightly")] try_from! { u8, u16, u32, u64, u128, usize } -#[cfg(not(feature = "nightly"))] -try_from! { i8, i16, i32, i64, isize } -#[cfg(not(feature = "nightly"))] -try_from! { u8, u16, u32, u64, usize } - try_from! { f32 } impl TryFrom for Signifix { diff --git a/src/lib.rs b/src/lib.rs index 2a66e62..f9e324d 100644 --- a/src/lib.rs +++ b/src/lib.rs @@ -1,4 +1,4 @@ -// Copyright (c) 2016, 2017 Rouven Spreckels +// Copyright (c) 2016, 2017, 2018 Rouven Spreckels // // Usage of the works is permitted provided that // this instrument is retained with the works, so that @@ -82,9 +82,9 @@ //! //! ```toml //! [dependencies] -//! signifix = "0.8" +//! signifix = "0.9" //! -//! # Optionally enable `try_from` and `i128_type` support on nightly Rust. +//! # Optionally enable `try_from` support on nightly Rust. //! #[dependencies.signifix] //! #features = ["nightly"] //! ``` @@ -92,9 +92,9 @@ //! and this to your crate root: //! //! ``` -//! // Optionally enable `try_from` and `i128_type` support on nightly Rust. +//! // Optionally enable `try_from` support on nightly Rust. //! // Required if the `nightly` feature is enabled in your `Cargo.toml`. -//! //#![feature(try_from, i128_type)] +//! //#![feature(try_from)] //! //! extern crate signifix; //! ``` @@ -107,7 +107,7 @@ //! jumps to the left or right while making maximum use of their occupied space: //! //! ``` -//! # #![cfg_attr(feature = "nightly", feature(try_from, i128_type))] +//! # #![cfg_attr(feature = "nightly", feature(try_from))] //! use signifix::TryFrom; // Until stabilized. //! //! use signifix::{metric, binary, Result}; @@ -163,7 +163,7 @@ //! This is useful to smoothly refresh a transfer rate within a terminal: //! //! ``` -//! # #![cfg_attr(feature = "nightly", feature(try_from, i128_type))] +//! # #![cfg_attr(feature = "nightly", feature(try_from))] //! use signifix::TryFrom; // Until stabilized. //! //! use std::f64; @@ -214,7 +214,7 @@ //! direction with positive numbers being padded to align with negative ones: //! //! ``` -//! # #![cfg_attr(feature = "nightly", feature(try_from, i128_type))] +//! # #![cfg_attr(feature = "nightly", feature(try_from))] //! use signifix::TryFrom; // Until stabilized. //! //! use signifix::metric::{Signifix, Result, DEF_MAX_LEN}; @@ -239,7 +239,7 @@ //! positive numbers: //! //! ``` -//! # #![cfg_attr(feature = "nightly", feature(try_from, i128_type))] +//! # #![cfg_attr(feature = "nightly", feature(try_from))] //! use signifix::TryFrom; // Until stabilized. //! //! use signifix::metric::{Signifix, Error, Result}; @@ -261,7 +261,7 @@ //! of powers of two, such as memory boundaries due to binary addressing: //! //! ``` -//! # #![cfg_attr(feature = "nightly", feature(try_from, i128_type))] +//! # #![cfg_attr(feature = "nightly", feature(try_from))] //! use signifix::TryFrom; // Until stabilized. //! //! use signifix::binary::{Signifix, Error, Result}; @@ -302,7 +302,7 @@ //! `Signifix::fmt()` method: //! //! ``` -//! # #![cfg_attr(feature = "nightly", feature(try_from, i128_type))] +//! # #![cfg_attr(feature = "nightly", feature(try_from))] //! use signifix::TryFrom; // Until stabilized. //! //! use signifix::binary::{Signifix, Result}; @@ -347,7 +347,7 @@ //! type via its methods: //! //! ``` -//! # #![cfg_attr(feature = "nightly", feature(try_from, i128_type))] +//! # #![cfg_attr(feature = "nightly", feature(try_from))] //! use signifix::TryFrom; // Until stabilized. //! //! use signifix::metric::{Signifix, Result}; @@ -390,7 +390,7 @@ #![deny(missing_docs)] -#![cfg_attr(feature = "nightly", feature(try_from, i128_type))] +#![cfg_attr(feature = "nightly", feature(try_from))] use std::result; use std::error; diff --git a/src/metric.rs b/src/metric.rs index 78b9457..15c8890 100644 --- a/src/metric.rs +++ b/src/metric.rs @@ -1,4 +1,4 @@ -// Copyright (c) 2016, 2017 Rouven Spreckels +// Copyright (c) 2016, 2017, 2018 Rouven Spreckels // // Usage of the works is permitted provided that // this instrument is retained with the works, so that @@ -210,16 +210,9 @@ impl Display for Signifix { } } -#[cfg(feature = "nightly")] try_from! { i8, i16, i32, i64, i128, isize } -#[cfg(feature = "nightly")] try_from! { u8, u16, u32, u64, u128, usize } -#[cfg(not(feature = "nightly"))] -try_from! { i8, i16, i32, i64, isize } -#[cfg(not(feature = "nightly"))] -try_from! { u8, u16, u32, u64, usize } - try_from! { f32 } impl TryFrom for Signifix {