fn apply_mask(&mut self, mask: Mask) {
        for y in 0..self.size {
            for x in 0..self.size {
                let invert: bool = match mask.value() {
                    0 => (x + y) % 2 == 0,
                    1 => y % 2 == 0,
                    2 => x % 3 == 0,
                    3 => (x + y) % 3 == 0,
                    4 => (x / 3 + y / 2) % 2 == 0,
                    5 => x * y % 2 + x * y % 3 == 0,
                    6 => (x * y % 2 + x * y % 3) % 2 == 0,
                    7 => ((x + y) % 2 + x * y % 3) % 2 == 0,
                    _ => unreachable!(),
                };
                *self.module_mut(x, y) ^= invert & !self.isfunction[(y * self.size + x) as usize];
            }
        }
    }
// XORs the codeword modules in this QR Code with the given mask pattern.
// The function modules must be marked and the codeword bits must be drawn
// before masking. Due to the arithmetic of XOR, calling apply_mask() with
// the same mask value a second time will undo the mask. A final well-formed
// QR Code needs exactly one (not zero, two, etc.) mask applied.
XORs the codeword modules in this QR Code with the given mask pattern.
The function modules must be marked and the codeword bits must be drawn
before masking. Due to the arithmetic of XOR, calling apply_mask() with
the same mask value a second time will undo the mask. A final well-formed
QR Code needs exactly one (not zero, two, etc.) mask applied.
XORs the codeword modules in this QR Code with the given mask pattern . The function modules must be marked and the codeword bits must be drawn before masking . Due to the arithmetic of XOR calling apply_mask () with the same mask value a second time will undo the mask . A final well - formed QR Code needs exactly one ( not zero two etc . ) mask applied .
fn apply_mask(&mut self, mask: Mask) {
        for y in 0..self.size {
            for x in 0..self.size {
                let invert: bool = match mask.value() {
                    0 => (x + y) % 2 == 0,
                    1 => y % 2 == 0,
                    2 => x % 3 == 0,
                    3 => (x + y) % 3 == 0,
                    4 => (x / 3 + y / 2) % 2 == 0,
                    5 => x * y % 2 + x * y % 3 == 0,
                    6 => (x * y % 2 + x * y % 3) % 2 == 0,
                    7 => ((x + y) % 2 + x * y % 3) % 2 == 0,
                    _ => unreachable!(),
                };
                *self.module_mut(x, y) ^= invert & !self.isfunction[(y * self.size + x) as usize];
            }
        }
    }
fn apply_mask ( & mut self , mask : Mask ) { for y in 0 .. self . size { for x in 0 .. self . size { let invert : bool = match mask . value ( ) { 0 => ( x + y ) % 2 == 0 , 1 => y % 2 == 0 , 2 => x % 3 == 0 , 3 => ( x + y ) % 3 == 0 , 4 => ( x / 3 + y / 2 ) % 2 == 0 , 5 => x * y % 2 + x * y % 3 == 0 , 6 => ( x * y % 2 + x * y % 3 ) % 2 == 0 , 7 => ( ( x + y ) % 2 + x * y % 3 ) % 2 == 0 , _ => unreachable ! ( ) , } ; * self . module_mut ( x , y ) ^= invert & ! self . isfunction [ ( y * self . size + x ) as usize ] ; } } }
XORs the codeword modules in this QR Code with the given mask pattern.
XORs the codeword modules in this QR Code with the given mask pattern .
&mut self
mask
Mask