many small rustifications

This commit is contained in:
Henry Schimke
2023-01-10 14:33:47 -06:00
parent 752d8c87b9
commit 9f7a41f81c
23 changed files with 218 additions and 187 deletions

View File

@@ -54,16 +54,23 @@ impl Version {
dataRegionSizeRows,
dataRegionSizeColumns,
totalCodewords: {
// Calculate the total number of codewords
let mut total = 0;
let ecCodewords = &ecBlocks.getECCodewords();
let ecbArray = ecBlocks.getECBlocks();
for ecBlock in ecbArray {
total += ecBlock.getCount() * (ecBlock.getDataCodewords() + ecCodewords);
}
total
ecbArray.iter().fold(0, |acc, ecBlock| {
acc + ecBlock.getCount() * (ecBlock.getDataCodewords() + ecCodewords)
})
},
// totalCodewords: {
// // Calculate the total number of codewords
// let mut total = 0;
// let ecCodewords = &ecBlocks.getECCodewords();
// let ecbArray = ecBlocks.getECBlocks();
// for ecBlock in ecbArray {
// total += ecBlock.getCount() * (ecBlock.getDataCodewords() + ecCodewords);
// }
// total
// },
ecBlocks,
}
}