Skip to content

Commit 7e76353

Browse files
author
Sean Loiselle
committed
dec: prepare 0.4.5 release
1 parent 94b7688 commit 7e76353

File tree

3 files changed

+28
-3
lines changed

3 files changed

+28
-3
lines changed

README.md

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -10,10 +10,10 @@ libdecnumber.
1010
```
1111
# Cargo.toml
1212
[dependencies]
13-
dec = "0.4.4"
13+
dec = "0.4.5"
1414
```
1515

16-
**[View documentation.](https://docs.rs/dec/0.4.4/)**
16+
**[View documentation.](https://docs.rs/dec/0.4.5/)**
1717

1818
## decnumber-sys [![crates.io](https://img.shields.io/crates/v/decnumber-sys.svg)](https://crates.io/crates/decnumber-sys)
1919

dec/CHANGELOG.md

Lines changed: 25 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -5,6 +5,31 @@ All notable changes to this crate will be documented in this file.
55
The format is based on [Keep a Changelog], and this crate adheres to [Semantic
66
Versioning].
77

8+
## 0.4.5 - 2021-07-29
9+
10+
* Change `Decimal`'s API for `TryFrom<Decimal<N>> for T` where `T` are primitive
11+
integers. Previously, these conversions failed when the decimal's exponent was
12+
not 0. The API now accepts any values without significant digits in the
13+
value's fractional component, e.g. `1E10`, `2.00`, assuming the values fit
14+
into the target type.
15+
16+
To re-implement the prior behavior, check the value's exponent before
17+
performing the cast and return an error, e.g.
18+
19+
```rust
20+
pub fn cast_requiring_zero_exp<T, const N: usize>(
21+
d: Decimal<N>,
22+
) -> Result<T, dec::error::TryFromDecimalError>
23+
where
24+
T: TryFrom<Decimal<N>, Error = dec::error::TryFromDecimalError>,
25+
{
26+
if d.exponent() != 0 {
27+
return Err(dec::error::TryFromDecimalError);
28+
}
29+
T::try_from(d)
30+
}
31+
```
32+
833
## 0.4.4 - 2021-06-25
934

1035
* Fix a bug that prevented compilation in 32-bit environments.

dec/Cargo.toml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -8,7 +8,7 @@ repository = "https://github.com/MaterializeInc/rust-decnumber"
88
license = "Apache-2.0"
99
categories = ["api-bindings"]
1010
keywords = ["decimal", "decnumber"]
11-
version = "0.4.4"
11+
version = "0.4.5"
1212
edition = "2018"
1313

1414
[dependencies]

0 commit comments

Comments
 (0)