Browse Source

Testing rust_decimal

master
Julio Biason 3 years ago
parent
commit
91385103eb
  1. 48
      decimaltest/Cargo.lock
  2. 9
      decimaltest/Cargo.toml
  3. 15
      decimaltest/src/main.rs

48
decimaltest/Cargo.lock generated

@ -0,0 +1,48 @@
# This file is automatically @generated by Cargo.
# It is not intended for manual editing.
version = 3
[[package]]
name = "arrayvec"
version = "0.7.2"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "8da52d66c7071e2e3fa2a1e5c6d088fec47b593032b254f5e980de8ea54454d6"
[[package]]
name = "autocfg"
version = "1.1.0"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "d468802bab17cbc0cc575e9b053f41e72aa36bfa6b7f55e3529ffa43161b97fa"
[[package]]
name = "decimaltest"
version = "0.1.0"
dependencies = [
"rust_decimal",
]
[[package]]
name = "num-traits"
version = "0.2.14"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "9a64b1ec5cda2586e284722486d802acf1f7dbdc623e2bfc57e65ca1cd099290"
dependencies = [
"autocfg",
]
[[package]]
name = "rust_decimal"
version = "1.21.0"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "4214023b1223d02a4aad9f0bb9828317634a56530870a2eaf7200a99c0c10f68"
dependencies = [
"arrayvec",
"num-traits",
"serde",
]
[[package]]
name = "serde"
version = "1.0.136"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "ce31e24b01e1e524df96f1c2fdd054405f8d7376249a5110886fb4b658484789"

9
decimaltest/Cargo.toml

@ -0,0 +1,9 @@
[package]
name = "decimaltest"
version = "0.1.0"
edition = "2021"
# See more keys and their definitions at https://doc.rust-lang.org/cargo/reference/manifest.html
[dependencies]
rust_decimal = "1.21.0"

15
decimaltest/src/main.rs

@ -0,0 +1,15 @@
use rust_decimal::Decimal;
fn main() {
let initial = Decimal::new(202, 2);
println!("202, 2 = {}", initial.to_string());
// let negative = Decimal::new(202, -2);
// println!("202, -2 = {}", negative.to_string());
let value = Decimal::new(2345, 2);
let inc = value + Decimal::new(5, 0);
let dec = value - Decimal::new(5, 0);
println!("Inc = {}; Dec = {}", inc.to_string(), dec.to_string())
}
Loading…
Cancel
Save