Skip to main content

rank_receipts

Function rank_receipts 

Source
async fn rank_receipts(
    receipts: impl Stream<Item = (OwnedUserId, ReceiptData)>,
    num: &AtomicUsize,
) -> SmallVec<[ReceiptMap; 1]> ⓘ
Expand description

Pivot a room’s count-ordered receipts into rank-major order.

A user’s k-th receipt in the window lands in rank k, so rank 0 is the first receipt of every user and the budget counts a user once, on that rank. The ranks holding a user are therefore a prefix, which is what lets the next free rank be found by bisection.