set_rate discards the quote it displaces #8
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?
Exchange::set_rate(src/exchange.rs:362) overwrites whatever the pair heldand returns
(), throwing away theOption<Decimal>thatBTreeMap::inserthands back. A caller who wants the quote that was displaced — reasonable when
quotes arrive from a live feed and the movement is worth logging or acting on —
has to perform a separate
rate()lookup beforehand, repeating the work theinsert already did.
Return
Option<ExchangeRate>.While here:
rate/set_ratediverges both from the standard map vocabularythe type otherwise mirrors and from
MoneyBag's shape. Worth deciding whetherget/insertreads better, though the current names are defensible.Guideline: C-INTERMEDIATE.