A currency pair is the board's key, but the board keys on a bare tuple #22
Labels
No labels
kind
bug
kind
enhancement
kind
refactor
workflow
needs-info
workflow
needs-triage
workflow
ready-for-agent
workflow
ready-for-human
workflow
wontfix
No milestone
No assignees
1 participant
Notifications
Due date
No due date set.
Dependencies
No dependencies set
Reference
rosa/lucre#22
Loading…
Reference in a new issue
No description provided.
Delete branch "%!s()"
Deleting a branch is permanent. Although the deleted branch may continue to exist for a short time before it actually gets removed, it CANNOT be undone in most cases. Continue?
Exchangekeys its board onBTreeMap<(Currency, Currency), Decimal>(
src/exchange/table.rs:62), an anonymous tuple that means exactly whatPairmeans one file over — the currency priced and the currency it is priced in, in
that order.
Nothing names the tuple, so nothing stops the two currencies being transposed at
a call site:
rate,set_rate,remove_rate, and the iterators all build ordestructure
(base, quote)positionally, and a swap type-checks.Pairwasintroduced with named fields for that reason and already carries the ordering
the table documents — "by the currency priced, then by the currency it is priced
in" is derived
Ordon the pair.Key the map on
Pairinstead.PairgainsOrdandPartialOrd, the publicsignatures stay as they are — callers still pass two currencies — and the
conversion happens once at the boundary rather than at every entry.
Whether
Pairshould also appear in public signatures is a separate question,and answering "no" here costs nothing later.