pub fn diff_balances(base: &[u64], target: &[u64]) -> BalancesDiffExpand description
Computes a compact balance delta between two contiguous balance slices.
The returned BalancesDiff contains the information required to
reconstruct target from base.
The common portion of the two slices is encoded using packed two-bit tags,
statistical mode correction, zig-zag encoded signed differences, and
explicit target values where necessary. If target contains more balances
than base, the additional balances are stored in
BalancesDiff::appended_balances.
This is a convenience wrapper around diff_balances_iter.
§Complexity
O(n) time and O(k) additional space, where n is the number of balances
in the common portion and k is the number of changed balances.
§Examples
ⓘ
let delta = diff_balances(&base, &target);