Skip to main content

apply_balances

Function apply_balances 

Source
pub fn apply_balances(base: &mut Vec<u64>, delta: &ArchivedBalancesDiff)
Expand description

Applies a balance delta to a contiguous balance vector in place.

base must initially contain the balance snapshot from which delta was generated. After application, base contains the reconstructed target snapshot.

This is a convenience wrapper around apply_balances_iter for clients that store balances contiguously.

§Complexity

O(n + a) time and O(1) additional working space, excluding storage required for appended balances.

§Panics

In debug builds, panics if the length of base does not match the length represented by the delta’s tag vector.