From 1db9598cd29fcca5326245ca73c3439fbc2233c4 Mon Sep 17 00:00:00 2001 From: Kasper Date: Mon, 15 Mar 2021 00:45:08 +0100 Subject: [PATCH] Switch back to official `decimal` Switch back to official `decimal` because https://github.com/alkis/decimal/issues/59 is fixed --- Cargo.lock | 8 ++++---- Cargo.toml | 3 +-- README.md | 17 ++++++++--------- src/evaluator.rs | 2 +- src/lexer.rs | 2 +- src/lib.rs | 4 ++-- src/lookup.rs | 2 +- src/units.rs | 2 +- 8 files changed, 19 insertions(+), 21 deletions(-) diff --git a/Cargo.lock b/Cargo.lock index 5642166..c2239c3 100644 --- a/Cargo.lock +++ b/Cargo.lock @@ -16,14 +16,14 @@ checksum = "95752358c8f7552394baf48cd82695b345628ad3f170d607de3ca03b8dacca15" name = "cpc" version = "1.3.2" dependencies = [ - "decimal_fixes_mirror", + "decimal", ] [[package]] -name = "decimal_fixes_mirror" -version = "2.0.4-fix1.0.0" +name = "decimal" +version = "2.1.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "878957a52f4ae34351962b97a2bf349ec58cb86c91863e7b50f6f2c9bbd51ffa" +checksum = "5a8ab77e91baeb15034c3be91e87bff4665c9036216148e4996d9a9f5792114d" dependencies = [ "bitflags", "cc", diff --git a/Cargo.toml b/Cargo.toml index 0c694b2..e7f9881 100644 --- a/Cargo.toml +++ b/Cargo.toml @@ -13,5 +13,4 @@ keywords = ["math", "expression", "evaluate", "units", "convert"] categories = ["mathematics", "science", "parsing", "text-processing", "value-formatting"] [dependencies] -# decimal = "2.0.4" -decimal_fixes_mirror = "2.0.4-fix1.0.0" +decimal = "2.1.0" diff --git a/README.md b/README.md index 67532b4..487cdc5 100644 --- a/README.md +++ b/README.md @@ -8,7 +8,6 @@ cpc parses and evaluates strings of math, with support for units and conversion. It also lets you mix units, so for example `1 km - 1m` results in `Number { value: 999, unit: Meter }`. - [![Crates.io](https://img.shields.io/crates/v/cpc.svg)](https://crates.io/crates/cpc) [![Documentation](https://docs.rs/cpc/badge.svg)](https://docs.rs/cpc) @@ -171,14 +170,14 @@ match string { ### Potential Improvements - Support for conversion between Power, Current, Resistance and Voltage. Multiplication and division is currently supported, but not conversions using sqrt or pow. - Unit types - - Currency: How to go about dynamically updating the weights? - - Fuel consumption - - Data transfer rate - - Color codes - - Force - - Roman numerals - - Angles - - Flow rate + - Currency: How to go about dynamically updating the weights? + - Fuel consumption + - Data transfer rate + - Color codes + - Force + - Roman numerals + - Angles + - Flow rate ### Cross-compiling 1. [Install Docker](https://docs.docker.com/get-docker/) diff --git a/src/evaluator.rs b/src/evaluator.rs index 4128249..c75b6c9 100644 --- a/src/evaluator.rs +++ b/src/evaluator.rs @@ -1,4 +1,4 @@ -use decimal_fixes_mirror::d128; +use decimal::d128; use crate::{Token, Number}; use crate::units::{Unit, UnitType, convert, add, subtract, multiply, divide, modulo, pow}; use crate::parser::AstNode; diff --git a/src/lexer.rs b/src/lexer.rs index 8d5ab25..b4ff89b 100644 --- a/src/lexer.rs +++ b/src/lexer.rs @@ -1,5 +1,5 @@ use std::str::FromStr; -use decimal_fixes_mirror::d128; +use decimal::d128; use crate::{Token, TokenVector}; use crate::Operator::{Caret, Divide, LeftParen, Minus, Modulo, Multiply, Plus, RightParen}; use crate::UnaryOperator::{Percent, Factorial}; diff --git a/src/lib.rs b/src/lib.rs index 9e86159..ea8de80 100644 --- a/src/lib.rs +++ b/src/lib.rs @@ -23,7 +23,7 @@ //! ``` use std::time::{Instant}; -use decimal_fixes_mirror::d128; +use decimal::d128; use crate::units::Unit; /// Units, and functions you can use with them @@ -43,7 +43,7 @@ mod lookup; /// ```rust /// use cpc::{eval,Number}; /// use cpc::units::Unit; -/// use decimal_fixes_mirror::d128; +/// use decimal::d128; /// /// let x = Number { /// value: d128!(100), diff --git a/src/lookup.rs b/src/lookup.rs index 75f164b..3042f5f 100644 --- a/src/lookup.rs +++ b/src/lookup.rs @@ -1,6 +1,6 @@ use crate::NamedNumber::*; use crate::NamedNumber; -use decimal_fixes_mirror::d128; +use decimal::d128; /// Returns the corresponding [`d128`] of a [`NamedNumber`] pub fn lookup_named_number(named_number: &NamedNumber) -> d128 { diff --git a/src/units.rs b/src/units.rs index 26f1e41..a04fe57 100644 --- a/src/units.rs +++ b/src/units.rs @@ -1,4 +1,4 @@ -use decimal_fixes_mirror::d128; +use decimal::d128; use crate::Number; #[derive(Clone, Copy, PartialEq, Debug)]