pub fn apply_participation(
base: &mut Vec<u8>,
delta: &ArchivedParticipationDiff,
) -> Result<(), Error>Expand description
Applies a participation delta to a contiguous vector in place.
This is the contiguous-vector convenience API. Sparse deltas are delegated
to apply_participation_iter, while ParticipationDiff::AllZeros is
handled directly by replacing the destination with a zero-filled vector of
the encoded length.
After successful application, base contains the target participation
vector from which delta was produced.
§Errors
Returns Error::InvalidDelta if an encoded ParticipationDiff::AllZeros
length cannot be represented by the target vector or if a sparse delta is
internally inconsistent.
Returns Error::MalformedDelta if a sparse delta contains invalid
serialized payload data, such as a truncated or overflowing varint.
§Complexity
Sparse deltas require O(m + e) work, where m is the number of modified
entries and e is the number of appended flags.
An ParticipationDiff::AllZeros delta requires O(n) work to construct
the resulting zero-filled vector of length n.