A pair's Debug prints 278 characters and never spells the pair #27
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#27
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?
PairderivesDebugover twoCurrencyvalues, andCurrencyderives it overfour fields (
src/lib.rs:996), so a pair prints 278 characters that never oncespell the pair:
The alphabetic code — the one thing a reader is looking for — arrives as
[85, 83, 68], three decimal bytes to be decoded by hand. This is what a failingassert_eq!over two pairs prints, and what anydbg!or log line carrying apair, a rate, or an amount prints along with it.
Two scopes:
DebugonCurrencywritingCurrency(USD). Every type holding acurrency —
Money,ExchangeRate,Pair,Exchange— is legible at once,and the catalog data stays reachable through the accessors that already expose
it.
DebugonPairalone, writingPair("USD/EUR"). Fixes the pair andleaves
Moneyand the rest as they are.The first is the one worth making; the value in a currency is its code, and the
rest is a lookup table the debugger does not need reprinted.
IsoAlphabeticCodewants the same treatment for the same reason.
Debug output is not a stability guarantee, but it changes for anyone asserting
on it. Choosing the scope is what this needs before it can be picked up.