pub fn verify_bank_correctness(&self) {
        // There is at most one golden bank between internal and external flash
        let total_golden = self.external_banks.iter().filter(|b| b.is_golden).count()
            + self.mcu_banks.iter().filter(|b| b.is_golden).count();
        assert!(total_golden <= 1);

        // There is only one bootable MCU bank
        assert_eq!(self.mcu_banks().filter(|b| b.bootable).count(), 1);

        // Banks are sequential across flash chips
        let all_bank_indices =
            self.mcu_banks().map(|b| b.index).chain(self.external_banks().map(|b| b.index));
        all_bank_indices.fold(0, |previous, current| {
            assert!(previous + 1 == current, "Flash banks are not in sequence!");
            current
        });

        // Either there's external flash, or there's no external flash and no banks.
        assert!(
            self.external_flash.is_some()
                || (self.external_flash.is_none() && self.external_banks().count() == 0),
            "Incorrect external flash configuration"
        );
    }
/// Makes several sanity checks on the flash bank configuration.
Makes several sanity checks on the flash bank configuration.
Makes several sanity checks on the flash bank configuration .
pub fn verify_bank_correctness(&self) {
        // There is at most one golden bank between internal and external flash
        let total_golden = self.external_banks.iter().filter(|b| b.is_golden).count()
            + self.mcu_banks.iter().filter(|b| b.is_golden).count();
        assert!(total_golden <= 1);
        // There is only one bootable MCU bank
        assert_eq!(self.mcu_banks().filter(|b| b.bootable).count(), 1);
        // Banks are sequential across flash chips
        let all_bank_indices =
            self.mcu_banks().map(|b| b.index).chain(self.external_banks().map(|b| b.index));
        all_bank_indices.fold(0, |previous, current| {
            assert!(previous + 1 == current, "Flash banks are not in sequence!");
            current
        });
        // Either there's external flash, or there's no external flash and no banks.
        assert!(
            self.external_flash.is_some()
                || (self.external_flash.is_none() && self.external_banks().count() == 0),
            "Incorrect external flash configuration"
        );
    }
pub fn verify_bank_correctness ( & self ) { // There is at most one golden bank between internal and external flash let total_golden = self . external_banks . iter ( ) . filter ( | b | b . is_golden ) . count ( ) + self . mcu_banks . iter ( ) . filter ( | b | b . is_golden ) . count ( ) ; assert ! ( total_golden 1 ) ; // There is only one bootable MCU bank assert_eq ! ( self mcu_banks ( ) filter ( b b bootable ) count ( ) 1 ) ; // Banks are sequential across flash chips let all_bank_indices = self . mcu_banks ( ) . map ( | b | b . index ) . chain ( self . external_banks ( ) . map ( | b | b . index ) ) ; all_bank_indices . fold ( 0 , | previous , current | { assert ! ( previous 1 current " " ) ; current } ) ; // Either there's external flash, or there's no external flash and no banks. assert ! ( self external_flash is_some ( ) ( self external_flash is_none ( ) self external_banks ( ) count ( ) 0 ) " " ) ; }
Makes several sanity checks on the flash bank configuration.
Makes several sanity checks on the flash bank configuration .
&self
&self