/// Check that the set of CH masks is preserved by the part head.
Check that the set of CH masks is preserved by the part head.
Check that the set of CH masks is preserved by the part head .
fn check_chs_in_other_parts(chs: &[CourseHeadMask], part_head: &Row) -> Result<()> {
    for part_head in part_head.closure() {
        'ch_loop: for mask in chs {
            let mask_in_other_part = part_head.mul(mask.mask());
            // Check if there's an entry in `chs` which matches the `mask_in_other_part`
            for mask2 in chs {
                if mask_in_other_part.is_subset_of(mask2.mask()) {
                    continue 'ch_loop; // `mask2` contains `transposed_mask`, so we're good
                }
            }
            // If no matching CH mask was found, then `mask` doesn't have any matching entry in
            // the part starting with `ph`
            return Err(Error::NoCourseHeadInPart {
                mask_in_first_part: mask.mask().to_owned(),
                part_head,
                mask_in_other_part,
            });
        }
    }
    Ok(()) // If we didn't find a mismatch, then the CHs are OK
}
fn check_chs_in_other_parts ( chs : & [ CourseHeadMask ] , part_head : & Row ) -> Result < ( ) > { for part_head in part_head . closure ( ) { ' ch_loop : for mask in chs { let mask_in_other_part = part_head . mul ( mask . mask ( ) ) ; // Check if there's an entry in `chs` which matches the `mask_in_other_part` for mask2 in chs { if mask_in_other_part . is_subset_of ( mask2 . mask ( ) ) { continue ' ch_loop ; // `mask2` contains `transposed_mask`, so we're good } } // If no matching CH mask was found, then `mask` doesn't have any matching entry in // the part starting with `ph` return Err ( Error :: NoCourseHeadInPart { mask_in_first_part : mask . mask ( ) . to_owned ( ) , part_head , mask_in_other_part , } ) ; } } Ok ( ( ) ) // If we didn't find a mismatch, then the CHs are OK }
Check that the set of CH masks is preserved by the part head.
Check that the set of CH masks is preserved by the part head .
chs
&[CourseHeadMask]
part_head
&Row