Exchange lacks Hash, ExchangeRate lacks Display #12

Open
opened 2026-08-14 21:13:11 +00:00 by rosa · 0 comments
Owner

Two gaps in the traits the types in src/exchange.rs implement.

Exchange does not derive Hash. It derives Clone, Debug, Default, Eq, PartialEq. MoneyBag derives Hash (src/bag.rs:41), and
BTreeMap<K, V>: Hash where both parameters are, so the derive is available.

ExchangeRate does not implement Display. Money, MoneyBag, Currency,
IsoAlphabeticCode and IsoNumericCode all do. A rate therefore cannot appear
in a user-facing message without hand-assembling it from three getters.

Guideline: C-COMMON-TRAITS.

Two gaps in the traits the types in `src/exchange.rs` implement. **`Exchange` does not derive `Hash`.** It derives `Clone, Debug, Default, Eq, PartialEq`. `MoneyBag` derives `Hash` (`src/bag.rs:41`), and `BTreeMap<K, V>: Hash` where both parameters are, so the derive is available. **`ExchangeRate` does not implement `Display`.** `Money`, `MoneyBag`, `Currency`, `IsoAlphabeticCode` and `IsoNumericCode` all do. A rate therefore cannot appear in a user-facing message without hand-assembling it from three getters. Guideline: C-COMMON-TRAITS.
Sign in to join this conversation.
No labels
No milestone
No assignees
1 participant
Notifications
Due date
The due date is invalid or out of range. Please use the format "yyyy-mm-dd".

No due date set.

Dependencies

No dependencies set

Reference
rosa/lucre#12
No description provided.