Commit Graph

26 Commits

Author SHA1 Message Date
Dr. Maxim Orlovsky b2c8a7ebc1
Merge pull request #615 from sgeisler/2021-06-sum-amounts
Implement `Sum` for amount types
2021-09-11 00:11:15 +02:00
Devrandom 4826d0c6cc no_std support
Based on the original work by Justin Moon.

*MSRV unchanged from 1.29.0.*

When `std` is off, `no-std` must be on, and we use the [`alloc`](https://doc.rust-lang.org/alloc/) and core2 crates. The `alloc` crate requires the user define a global allocator.

* Import from `core` and `alloc` instead of `std`
* `alloc` only used if `no-std` is on
* Create `std` feature
* Create `no-std` feature which adds a core2 dependency to polyfill `std::io` features. This is an experimental feature and should be
used with caution.
* CI runs tests `no-std`
* MSRV for `no-std` is 1.51 or so
2021-07-15 09:04:49 +02:00
Sebastian Geisler 4dae56908b Seal `CheckedSum` 2021-06-23 15:14:24 +02:00
Sebastian Geisler 6f7da5f2ef Implement `CheckedSum` for amount types
It's just `Sum` with checked arithmetic.
2021-06-12 17:23:30 +02:00
Sebastian Geisler f28110b31c implement `Sum` for amount types
To be able to sum up iterators of amounts it is
not sufficient that these implement `Add`, they
also need to implement `Sum`.
2021-06-12 17:23:27 +02:00
Devrandom 95aa3bf153 std -> core 2021-06-11 17:28:04 +02:00
Riccardo Casatta ef471ccca7
Fix documentation, in particular link to code elements 2021-05-03 11:43:11 +02:00
Andrew Poelstra 20f1543f79
Merge pull request #552 from JeremyRubin/fix-amount-serde
Fix Optional Amount Serialization
2021-03-15 15:48:20 +00:00
Jeremy Rubin a0c7f530ba Localize breaking changes of fixing the Amount serialization to only the
broken Option<SerdeAmount> serializer.
2021-02-28 09:13:52 -08:00
Sebastian 3ecab20c17
Merge pull request #414 from stevenroose/amount-debug
Change Amount Debug impl to BTC with 8 decimals
2021-02-21 15:14:40 +01:00
Jeremy Rubin da21294ac5 Fix Optional Amount Serialization 2021-01-14 10:46:20 -08:00
Elichai Turkel 2d70623356
Remove deprecated Error::description impl 2020-10-08 17:11:18 +03:00
Elichai Turkel 023fae1f65
Add the dyn keyword where appropriate 2020-10-08 17:11:16 +03:00
Elichai Turkel efe1a55819
Use new inclusive range syntax 2020-10-08 17:08:51 +03:00
Andrew Poelstra 7efde3ae47
Merge pull request #419 from elichai/2020-03-description
Deprecate Error::description
2020-05-23 17:26:38 +00:00
Elichai Turkel 654232a3dc
Deprecate Error::description 2020-04-13 02:15:28 +03:00
Elichai Turkel 2cc88a99aa
Removed PartialEq,PartialOrd impls, shouldn't be manually impl when Hash is derived 2020-03-29 17:15:15 +03:00
Elichai Turkel a473d01b17
Made some idiomatic changes 2020-03-29 17:15:15 +03:00
Elichai Turkel 3f2d428706
Remove needless references 2020-03-29 17:15:14 +03:00
Steven Roose 6186ee6269
Change Amount Debug impl to BTC with 8 decimals 2020-03-07 19:52:16 +00:00
Elichai Turkel 07b30c7fac
Mutation testing: amount: Added tests to fix mutation misses 2020-02-23 15:59:26 +02:00
Elichai Turkel ab6e20c87e
Fix an overflow bug in SignedAmount to_string/fmt 2020-02-23 15:59:26 +02:00
Elichai Turkel 52ff97cddc
Deny unused imports and remove unneeded 2019-08-19 13:29:43 -04:00
Elichai Turkel a9e65f36d3
Check that the amount precision isn't more than the size of the amount 2019-08-09 10:41:21 -04:00
practicalswift 8152ed758c Fix typos 2019-08-04 19:27:36 +00:00
Steven Roose 688d95b463
Add Amount and SignedAmount types 2019-05-31 10:18:59 +01:00