The two iterator pairs are the same code twice #35
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#35
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?
What to build
BalancesandIntoBalancesin the bag module, andRatesandIntoRatesinthe exchange table module, are the same code written twice — around 167 lines.
Each is a newtype over a
BTreeMapiterator with five trait impls(
Iteratorwithsize_hint,DoubleEndedIterator,ExactSizeIterator,FusedIterator), plus a pair of free functions that differ only in whichconstructor they call.
Write one private macro that generates a borrowed and an owned iterator over a
BTreeMap, given the two type names, the key and value types, the item type,and how to build an item from an entry. Use it in both modules.
The four public type names, their documentation, and their examples stay as they
are.
Acceptance criteria
Balances,IntoBalances,Rates, andIntoRateskeep their names and public documentationsize_hintandExactSizeIterator::lenmise run cipassesBlocked by
None — can start immediately.