fn compute_chip_erase_pages_and_weight(
        &self,
        sectors: &mut Vec<FlashSector>,
        region: &FlashRegion,
    ) -> (u32, f32) {
        let mut chip_erase_count: u32 = 0;
        // TODO: Fix the `get_flash_info` param.
        let mut chip_erase_weight: f32 = region.get_flash_info(true).erase_weight;
        for page in Self::pages_mut(sectors) {
            if let Some(erased) = page.erased {
                if !erased {
                    chip_erase_count += 1;
                    chip_erase_weight += page.get_program_weight();
                    // TODO: check if this next line is valid.
                    page.erased = Some(region.is_erased(page.data.as_slice()));
                }
            } else {
                page.erased = Some(region.is_erased(page.data.as_slice()));
            }
        }
        (chip_erase_count, chip_erase_weight)
    }
/// Compute the number of erased pages.
///
/// Determine how many pages in the new data are already erased.
Compute the number of erased pages.
Determine how many pages in the new data are already erased.
Compute the number of erased pages . Determine how many pages in the new data are already erased .
fn compute_chip_erase_pages_and_weight(
        &self,
        sectors: &mut Vec<FlashSector>,
        region: &FlashRegion,
    ) -> (u32, f32) {
        let mut chip_erase_count: u32 = 0;
        // TODO: Fix the `get_flash_info` param.
        let mut chip_erase_weight: f32 = region.get_flash_info(true).erase_weight;
        for page in Self::pages_mut(sectors) {
            if let Some(erased) = page.erased {
                if !erased {
                    chip_erase_count += 1;
                    chip_erase_weight += page.get_program_weight();
                    // TODO: check if this next line is valid.
                    page.erased = Some(region.is_erased(page.data.as_slice()));
                }
            } else {
                page.erased = Some(region.is_erased(page.data.as_slice()));
            }
        }
        (chip_erase_count, chip_erase_weight)
    }
fn compute_chip_erase_pages_and_weight ( & self , sectors : & mut Vec < FlashSector > , region : & FlashRegion , ) -> ( u32 , f32 ) { let mut chip_erase_count : u32 = 0 ; // TODO: Fix the `get_flash_info` param. let mut chip_erase_weight : f32 = region . get_flash_info ( true ) . erase_weight ; for page in Self :: pages_mut ( sectors ) { if let Some ( erased ) = page . erased { if ! erased { chip_erase_count += 1 ; chip_erase_weight += page . get_program_weight ( ) ; // TODO: check if this next line is valid. page . erased = Some ( region . is_erased ( page . data . as_slice ( ) ) ) ; } } else { page . erased = Some ( region . is_erased ( page . data . as_slice ( ) ) ) ; } } ( chip_erase_count , chip_erase_weight ) }
Compute the number of erased pages.
Compute the number of erased pages .
&self
sectors
&mut Vec<FlashSector>
region
&FlashRegion