Function leopard_codec::reconstruct
source · pub fn reconstruct(
shards: &mut [impl AsMut<Vec<u8>>],
data_shards: usize
) -> Result<()>
Expand description
Reconstructs original shards from the provided slice.
The shards which are missing should be provided as empty Vec
s.
Reconstruction can only happen if the amount of present data and parity shards
is equal or greater than the data_shards
.
The first data_shards
shards will be the treated as data shards
and the rest as parity shards.
§Errors
If too few shards are present to reconstruct original data or shards were of incorrect or different lengths.