| 1 | //! Contains the HEIGHT functions that can alter `QRCode` |
| 2 | #![deny(unsafe_code)] |
| 3 | #![warn(missing_docs)] |
| 4 | |
| 5 | use craterust-analyzer cargo fast_qr 0.13.1 crate/::modulerust-analyzer cargo fast_qr 0.13.1 module/::ModuleTyperust-analyzer cargo fast_qr 0.13.1 module/ModuleType#; |
| 6 | use craterust-analyzer cargo fast_qr 0.13.1 crate/::QRCoderust-analyzer cargo fast_qr 0.13.1 qr/QRCode#; |
| 7 | |
| 8 | /// The different mask patterns. The mask pattern should only be applied to |
| 9 | /// the data and error correction portion of the QR code. |
| 10 | #[deriverust-analyzer cargo core https://github.com/rust-lang/rust/library/core macros/builtin/derive:(Debugrust-analyzer cargo core https://github.com/rust-lang/rust/library/core fmt/macros/Debug:, Copyrust-analyzer cargo core https://github.com/rust-lang/rust/library/core marker/Copy:, Clonerust-analyzer cargo core https://github.com/rust-lang/rust/library/core clone/Clone:)] |
| 11 | pub enum Maskrust-analyzer cargo fast_qr 0.13.1 datamasking/Mask# { |
| 12 | /// QR code pattern n°0: `(x + y) % 2 == 0`. |
| 13 | Checkerboardrust-analyzer cargo fast_qr 0.13.1 datamasking/Mask#Checkerboard# = 0, |
| 14 | /// QR code pattern n°1: `y % 2 == 0`. |
| 15 | HorizontalLinesrust-analyzer cargo fast_qr 0.13.1 datamasking/Mask#HorizontalLines# = 1, |
| 16 | /// QR code pattern n°2: `x % 3 == 0`. |
| 17 | VerticalLinesrust-analyzer cargo fast_qr 0.13.1 datamasking/Mask#VerticalLines# = 2, |
| 18 | /// QR code pattern n°3: `(x + y) % 3 == 0`. |
| 19 | DiagonalLinesrust-analyzer cargo fast_qr 0.13.1 datamasking/Mask#DiagonalLines# = 3, |
| 20 | /// QR code pattern n°4: `((x/3) + (y/2)) % 2 == 0`. |
| 21 | LargeCheckerboardrust-analyzer cargo fast_qr 0.13.1 datamasking/Mask#LargeCheckerboard# = 4, |
| 22 | /// QR code pattern n°5: `(x*y)%2 + (x*y)%3 == 0`. |
| 23 | Fieldsrust-analyzer cargo fast_qr 0.13.1 datamasking/Mask#Fields# = 5, |
| 24 | /// QR code pattern n°6: `((x*y)%2 + (x*y)%3) % 2 == 0`. |
| 25 | Diamondsrust-analyzer cargo fast_qr 0.13.1 datamasking/Mask#Diamonds# = 6, |
| 26 | /// QR code pattern n°7: `((x+y)%2 + (x*y)%3) % 2 == 0`. |
| 27 | Meadowrust-analyzer cargo fast_qr 0.13.1 datamasking/Mask#Meadow# = 7, |
| 28 | } |
| 29 | |
| 30 | /// Mask function nb°**0**, `Mask::Checkerboard`. |
| 31 | fn mask_checkerboardrust-analyzer cargo fast_qr 0.13.1 datamasking/mask_checkerboard().(qr: &mut QRCoderust-analyzer cargo fast_qr 0.13.1 qr/QRCode#) { |
| 32 | for row in 0..rust-analyzer cargo core https://github.com/rust-lang/rust/library/core ops/range/Range#qr.sizerust-analyzer cargo fast_qr 0.13.1 qr/QRCode#size. { |
| 33 | for column in (row rust-analyzer cargo core https://github.com/rust-lang/rust/library/core ops/bit/impl#[usize][`BitAnd<Self>`]bitand().&rust-analyzer cargo core https://github.com/rust-lang/rust/library/core ops/bit/impl#[usize][`BitAnd<Self>`]bitand(). rust-analyzer cargo core https://github.com/rust-lang/rust/library/core ops/bit/impl#[usize][`BitAnd<Self>`]bitand().1..rust-analyzer cargo core https://github.com/rust-lang/rust/library/core ops/range/Range#qr.sizerust-analyzer cargo fast_qr 0.13.1 qr/QRCode#size.).step_byrust-analyzer cargo core https://github.com/rust-lang/rust/library/core iter/traits/iterator/Iterator#step_by().(2) { |
| 34 | let module = &mut qr[rust-analyzer cargo core https://github.com/rust-lang/rust/library/core ops/index/IndexMut#index_mut().row]rust-analyzer cargo core https://github.com/rust-lang/rust/library/core ops/index/IndexMut#index_mut().[rust-analyzer cargo core https://github.com/rust-lang/rust/library/core slice/index/impl#[`[T]`][`IndexMut<I>`]index_mut().column]rust-analyzer cargo core https://github.com/rust-lang/rust/library/core slice/index/impl#[`[T]`][`IndexMut<I>`]index_mut().; |
| 35 | if module.module_typerust-analyzer cargo fast_qr 0.13.1 module/impl#[Module]module_type().() rust-analyzer cargo fast_qr 0.13.1 module/impl#[ModuleType][`PartialEq<Self>`]eq().==rust-analyzer cargo fast_qr 0.13.1 module/impl#[ModuleType][`PartialEq<Self>`]eq(). rust-analyzer cargo fast_qr 0.13.1 module/impl#[ModuleType][`PartialEq<Self>`]eq().ModuleTyperust-analyzer cargo fast_qr 0.13.1 module/ModuleType#::Datarust-analyzer cargo fast_qr 0.13.1 module/ModuleType#Data# { |
| 36 | module.togglerust-analyzer cargo fast_qr 0.13.1 module/impl#[Module]toggle().(); |
| 37 | } |
| 38 | } |
| 39 | } |
| 40 | } |
| 41 | |
| 42 | /// Mask function nb°**1**, `Mask::HorizontalLines`. |
| 43 | fn mask_horizontalrust-analyzer cargo fast_qr 0.13.1 datamasking/mask_horizontal().(qr: &mut QRCoderust-analyzer cargo fast_qr 0.13.1 qr/QRCode#) { |
| 44 | for row in (0..rust-analyzer cargo core https://github.com/rust-lang/rust/library/core ops/range/Range#qr.sizerust-analyzer cargo fast_qr 0.13.1 qr/QRCode#size.).step_byrust-analyzer cargo core https://github.com/rust-lang/rust/library/core iter/traits/iterator/Iterator#step_by().(2) { |
| 45 | for column in 0..rust-analyzer cargo core https://github.com/rust-lang/rust/library/core ops/range/Range#qr.sizerust-analyzer cargo fast_qr 0.13.1 qr/QRCode#size. { |
| 46 | let module = &mut qr[rust-analyzer cargo core https://github.com/rust-lang/rust/library/core ops/index/IndexMut#index_mut().row]rust-analyzer cargo core https://github.com/rust-lang/rust/library/core ops/index/IndexMut#index_mut().[rust-analyzer cargo core https://github.com/rust-lang/rust/library/core slice/index/impl#[`[T]`][`IndexMut<I>`]index_mut().column]rust-analyzer cargo core https://github.com/rust-lang/rust/library/core slice/index/impl#[`[T]`][`IndexMut<I>`]index_mut().; |
| 47 | if module.module_typerust-analyzer cargo fast_qr 0.13.1 module/impl#[Module]module_type().() rust-analyzer cargo fast_qr 0.13.1 module/impl#[ModuleType][`PartialEq<Self>`]eq().==rust-analyzer cargo fast_qr 0.13.1 module/impl#[ModuleType][`PartialEq<Self>`]eq(). rust-analyzer cargo fast_qr 0.13.1 module/impl#[ModuleType][`PartialEq<Self>`]eq().ModuleTyperust-analyzer cargo fast_qr 0.13.1 module/ModuleType#::Datarust-analyzer cargo fast_qr 0.13.1 module/ModuleType#Data# { |
| 48 | module.togglerust-analyzer cargo fast_qr 0.13.1 module/impl#[Module]toggle().(); |
| 49 | } |
| 50 | } |
| 51 | } |
| 52 | } |
| 53 | |
| 54 | /// Mask function nb°**2**, `Mask::VerticalLines`. |
| 55 | fn mask_verticalrust-analyzer cargo fast_qr 0.13.1 datamasking/mask_vertical().(qr: &mut QRCoderust-analyzer cargo fast_qr 0.13.1 qr/QRCode#) { |
| 56 | for row in 0..rust-analyzer cargo core https://github.com/rust-lang/rust/library/core ops/range/Range#qr.sizerust-analyzer cargo fast_qr 0.13.1 qr/QRCode#size. { |
| 57 | for column in (0..rust-analyzer cargo core https://github.com/rust-lang/rust/library/core ops/range/Range#qr.sizerust-analyzer cargo fast_qr 0.13.1 qr/QRCode#size.).step_byrust-analyzer cargo core https://github.com/rust-lang/rust/library/core iter/traits/iterator/Iterator#step_by().(3) { |
| 58 | let module = &mut qr[rust-analyzer cargo core https://github.com/rust-lang/rust/library/core ops/index/IndexMut#index_mut().row]rust-analyzer cargo core https://github.com/rust-lang/rust/library/core ops/index/IndexMut#index_mut().[rust-analyzer cargo core https://github.com/rust-lang/rust/library/core slice/index/impl#[`[T]`][`IndexMut<I>`]index_mut().column]rust-analyzer cargo core https://github.com/rust-lang/rust/library/core slice/index/impl#[`[T]`][`IndexMut<I>`]index_mut().; |
| 59 | if module.module_typerust-analyzer cargo fast_qr 0.13.1 module/impl#[Module]module_type().() rust-analyzer cargo fast_qr 0.13.1 module/impl#[ModuleType][`PartialEq<Self>`]eq().==rust-analyzer cargo fast_qr 0.13.1 module/impl#[ModuleType][`PartialEq<Self>`]eq(). rust-analyzer cargo fast_qr 0.13.1 module/impl#[ModuleType][`PartialEq<Self>`]eq().ModuleTyperust-analyzer cargo fast_qr 0.13.1 module/ModuleType#::Datarust-analyzer cargo fast_qr 0.13.1 module/ModuleType#Data# { |
| 60 | module.togglerust-analyzer cargo fast_qr 0.13.1 module/impl#[Module]toggle().(); |
| 61 | } |
| 62 | } |
| 63 | } |
| 64 | } |
| 65 | |
| 66 | /// Mask function nb°**3**, `Mask::DiagonalLines`. |
| 67 | fn mask_diagonalrust-analyzer cargo fast_qr 0.13.1 datamasking/mask_diagonal().(qr: &mut QRCoderust-analyzer cargo fast_qr 0.13.1 qr/QRCode#) { |
| 68 | for row in 0..rust-analyzer cargo core https://github.com/rust-lang/rust/library/core ops/range/Range#qr.sizerust-analyzer cargo fast_qr 0.13.1 qr/QRCode#size. { |
| 69 | let start = (3 rust-analyzer cargo core https://github.com/rust-lang/rust/library/core ops/arith/impl#[usize][`Sub<Self>`]sub().-rust-analyzer cargo core https://github.com/rust-lang/rust/library/core ops/arith/impl#[usize][`Sub<Self>`]sub(). rust-analyzer cargo core https://github.com/rust-lang/rust/library/core ops/arith/impl#[usize][`Sub<Self>`]sub().row rust-analyzer cargo core https://github.com/rust-lang/rust/library/core ops/arith/impl#[usize][`Rem<Self>`]rem().%rust-analyzer cargo core https://github.com/rust-lang/rust/library/core ops/arith/impl#[usize][`Rem<Self>`]rem(). rust-analyzer cargo core https://github.com/rust-lang/rust/library/core ops/arith/impl#[usize][`Rem<Self>`]rem().3) rust-analyzer cargo core https://github.com/rust-lang/rust/library/core ops/arith/impl#[usize][`Rem<Self>`]rem().%rust-analyzer cargo core https://github.com/rust-lang/rust/library/core ops/arith/impl#[usize][`Rem<Self>`]rem(). rust-analyzer cargo core https://github.com/rust-lang/rust/library/core ops/arith/impl#[usize][`Rem<Self>`]rem().3; |
| 70 | for column in (start..rust-analyzer cargo core https://github.com/rust-lang/rust/library/core ops/range/Range#qr.sizerust-analyzer cargo fast_qr 0.13.1 qr/QRCode#size.).step_byrust-analyzer cargo core https://github.com/rust-lang/rust/library/core iter/traits/iterator/Iterator#step_by().(3) { |
| 71 | let module = &mut qr[rust-analyzer cargo core https://github.com/rust-lang/rust/library/core ops/index/IndexMut#index_mut().row]rust-analyzer cargo core https://github.com/rust-lang/rust/library/core ops/index/IndexMut#index_mut().[rust-analyzer cargo core https://github.com/rust-lang/rust/library/core slice/index/impl#[`[T]`][`IndexMut<I>`]index_mut().column]rust-analyzer cargo core https://github.com/rust-lang/rust/library/core slice/index/impl#[`[T]`][`IndexMut<I>`]index_mut().; |
| 72 | if module.module_typerust-analyzer cargo fast_qr 0.13.1 module/impl#[Module]module_type().() rust-analyzer cargo fast_qr 0.13.1 module/impl#[ModuleType][`PartialEq<Self>`]eq().==rust-analyzer cargo fast_qr 0.13.1 module/impl#[ModuleType][`PartialEq<Self>`]eq(). rust-analyzer cargo fast_qr 0.13.1 module/impl#[ModuleType][`PartialEq<Self>`]eq().ModuleTyperust-analyzer cargo fast_qr 0.13.1 module/ModuleType#::Datarust-analyzer cargo fast_qr 0.13.1 module/ModuleType#Data# { |
| 73 | module.togglerust-analyzer cargo fast_qr 0.13.1 module/impl#[Module]toggle().(); |
| 74 | } |
| 75 | } |
| 76 | } |
| 77 | } |
| 78 | |
| 79 | /// Mask function nb°**4**, `Mask::LargeCheckerboard`. |
| 80 | fn mask_large_checkerboardrust-analyzer cargo fast_qr 0.13.1 datamasking/mask_large_checkerboard().(qr: &mut QRCoderust-analyzer cargo fast_qr 0.13.1 qr/QRCode#) { |
| 81 | for row in 0..rust-analyzer cargo core https://github.com/rust-lang/rust/library/core ops/range/Range#qr.sizerust-analyzer cargo fast_qr 0.13.1 qr/QRCode#size. { |
| 82 | let start = ((row rust-analyzer cargo core https://github.com/rust-lang/rust/library/core ops/bit/impl#[usize][`Shr<i32>`]shr().>>rust-analyzer cargo core https://github.com/rust-lang/rust/library/core ops/bit/impl#[usize][`Shr<i32>`]shr(). rust-analyzer cargo core https://github.com/rust-lang/rust/library/core ops/bit/impl#[usize][`Shr<i32>`]shr().1) rust-analyzer cargo core https://github.com/rust-lang/rust/library/core ops/bit/impl#[usize][`BitAnd<Self>`]bitand().&rust-analyzer cargo core https://github.com/rust-lang/rust/library/core ops/bit/impl#[usize][`BitAnd<Self>`]bitand(). rust-analyzer cargo core https://github.com/rust-lang/rust/library/core ops/bit/impl#[usize][`BitAnd<Self>`]bitand().1) rust-analyzer cargo core https://github.com/rust-lang/rust/library/core ops/arith/impl#[usize][`Mul<Self>`]mul().*rust-analyzer cargo core https://github.com/rust-lang/rust/library/core ops/arith/impl#[usize][`Mul<Self>`]mul(). rust-analyzer cargo core https://github.com/rust-lang/rust/library/core ops/arith/impl#[usize][`Mul<Self>`]mul().3; // ((row / 2) % 2) * 3; |
| 83 | for column in (start..rust-analyzer cargo core https://github.com/rust-lang/rust/library/core ops/range/Range#qr.sizerust-analyzer cargo fast_qr 0.13.1 qr/QRCode#size.).step_byrust-analyzer cargo core https://github.com/rust-lang/rust/library/core iter/traits/iterator/Iterator#step_by().(6) { |
| 84 | for i in column..rust-analyzer cargo core https://github.com/rust-lang/rust/library/core ops/range/Range#corerust-analyzer cargo core https://github.com/rust-lang/rust/library/core crate/::cmprust-analyzer cargo core https://github.com/rust-lang/rust/library/core cmp/::minrust-analyzer cargo core https://github.com/rust-lang/rust/library/core cmp/min().(qr.sizerust-analyzer cargo fast_qr 0.13.1 qr/QRCode#size., column rust-analyzer cargo core https://github.com/rust-lang/rust/library/core ops/arith/impl#[usize][`Add<Self>`]add().+rust-analyzer cargo core https://github.com/rust-lang/rust/library/core ops/arith/impl#[usize][`Add<Self>`]add(). rust-analyzer cargo core https://github.com/rust-lang/rust/library/core ops/arith/impl#[usize][`Add<Self>`]add().3) { |
| 85 | let module = &mut qr[rust-analyzer cargo core https://github.com/rust-lang/rust/library/core ops/index/IndexMut#index_mut().row]rust-analyzer cargo core https://github.com/rust-lang/rust/library/core ops/index/IndexMut#index_mut().[rust-analyzer cargo core https://github.com/rust-lang/rust/library/core slice/index/impl#[`[T]`][`IndexMut<I>`]index_mut().i]rust-analyzer cargo core https://github.com/rust-lang/rust/library/core slice/index/impl#[`[T]`][`IndexMut<I>`]index_mut().; |
| 86 | if module.module_typerust-analyzer cargo fast_qr 0.13.1 module/impl#[Module]module_type().() rust-analyzer cargo fast_qr 0.13.1 module/impl#[ModuleType][`PartialEq<Self>`]eq().==rust-analyzer cargo fast_qr 0.13.1 module/impl#[ModuleType][`PartialEq<Self>`]eq(). rust-analyzer cargo fast_qr 0.13.1 module/impl#[ModuleType][`PartialEq<Self>`]eq().ModuleTyperust-analyzer cargo fast_qr 0.13.1 module/ModuleType#::Datarust-analyzer cargo fast_qr 0.13.1 module/ModuleType#Data# { |
| 87 | module.togglerust-analyzer cargo fast_qr 0.13.1 module/impl#[Module]toggle().(); |
| 88 | } |
| 89 | } |
| 90 | } |
| 91 | } |
| 92 | } |
| 93 | |
| 94 | fn mask_5_6rust-analyzer cargo fast_qr 0.13.1 datamasking/mask_5_6().(qr: &mut QRCoderust-analyzer cargo fast_qr 0.13.1 qr/QRCode#, offset: &[(usize, usize)]) { |
| 95 | for row in (0..rust-analyzer cargo core https://github.com/rust-lang/rust/library/core ops/range/Range#qr.sizerust-analyzer cargo fast_qr 0.13.1 qr/QRCode#size.).step_byrust-analyzer cargo core https://github.com/rust-lang/rust/library/core iter/traits/iterator/Iterator#step_by().(6) { |
| 96 | for column in 0..rust-analyzer cargo core https://github.com/rust-lang/rust/library/core ops/range/Range#qr.sizerust-analyzer cargo fast_qr 0.13.1 qr/QRCode#size. { |
| 97 | let module = &mut qr[rust-analyzer cargo core https://github.com/rust-lang/rust/library/core ops/index/IndexMut#index_mut().row]rust-analyzer cargo core https://github.com/rust-lang/rust/library/core ops/index/IndexMut#index_mut().[rust-analyzer cargo core https://github.com/rust-lang/rust/library/core slice/index/impl#[`[T]`][`IndexMut<I>`]index_mut().column]rust-analyzer cargo core https://github.com/rust-lang/rust/library/core slice/index/impl#[`[T]`][`IndexMut<I>`]index_mut().; |
| 98 | if module.module_typerust-analyzer cargo fast_qr 0.13.1 module/impl#[Module]module_type().() rust-analyzer cargo fast_qr 0.13.1 module/impl#[ModuleType][`PartialEq<Self>`]eq().==rust-analyzer cargo fast_qr 0.13.1 module/impl#[ModuleType][`PartialEq<Self>`]eq(). rust-analyzer cargo fast_qr 0.13.1 module/impl#[ModuleType][`PartialEq<Self>`]eq().ModuleTyperust-analyzer cargo fast_qr 0.13.1 module/ModuleType#::Datarust-analyzer cargo fast_qr 0.13.1 module/ModuleType#Data# { |
| 99 | module.togglerust-analyzer cargo fast_qr 0.13.1 module/impl#[Module]toggle().(); |
| 100 | } |
| 101 | let module = &mut qr[rust-analyzer cargo core https://github.com/rust-lang/rust/library/core ops/index/IndexMut#index_mut().column]rust-analyzer cargo core https://github.com/rust-lang/rust/library/core ops/index/IndexMut#index_mut().[rust-analyzer cargo core https://github.com/rust-lang/rust/library/core slice/index/impl#[`[T]`][`IndexMut<I>`]index_mut().row]rust-analyzer cargo core https://github.com/rust-lang/rust/library/core slice/index/impl#[`[T]`][`IndexMut<I>`]index_mut().; |
| 102 | if module.module_typerust-analyzer cargo fast_qr 0.13.1 module/impl#[Module]module_type().() rust-analyzer cargo fast_qr 0.13.1 module/impl#[ModuleType][`PartialEq<Self>`]eq().==rust-analyzer cargo fast_qr 0.13.1 module/impl#[ModuleType][`PartialEq<Self>`]eq(). rust-analyzer cargo fast_qr 0.13.1 module/impl#[ModuleType][`PartialEq<Self>`]eq().ModuleTyperust-analyzer cargo fast_qr 0.13.1 module/ModuleType#::Datarust-analyzer cargo fast_qr 0.13.1 module/ModuleType#Data# && (row rust-analyzer cargo core https://github.com/rust-lang/rust/library/core ops/arith/impl#[usize][`Rem<Self>`]rem().%rust-analyzer cargo core https://github.com/rust-lang/rust/library/core ops/arith/impl#[usize][`Rem<Self>`]rem(). rust-analyzer cargo core https://github.com/rust-lang/rust/library/core ops/arith/impl#[usize][`Rem<Self>`]rem().6 rust-analyzer cargo core https://github.com/rust-lang/rust/library/core cmp/impls/impl#[usize][`PartialEq<Self>`]ne().!=rust-analyzer cargo core https://github.com/rust-lang/rust/library/core cmp/impls/impl#[usize][`PartialEq<Self>`]ne(). rust-analyzer cargo core https://github.com/rust-lang/rust/library/core cmp/impls/impl#[usize][`PartialEq<Self>`]ne().0 || column rust-analyzer cargo core https://github.com/rust-lang/rust/library/core ops/arith/impl#[usize][`Rem<Self>`]rem().%rust-analyzer cargo core https://github.com/rust-lang/rust/library/core ops/arith/impl#[usize][`Rem<Self>`]rem(). rust-analyzer cargo core https://github.com/rust-lang/rust/library/core ops/arith/impl#[usize][`Rem<Self>`]rem().6 rust-analyzer cargo core https://github.com/rust-lang/rust/library/core cmp/impls/impl#[usize][`PartialEq<Self>`]ne().!=rust-analyzer cargo core https://github.com/rust-lang/rust/library/core cmp/impls/impl#[usize][`PartialEq<Self>`]ne(). rust-analyzer cargo core https://github.com/rust-lang/rust/library/core cmp/impls/impl#[usize][`PartialEq<Self>`]ne().0) { |
| 103 | module.togglerust-analyzer cargo fast_qr 0.13.1 module/impl#[Module]toggle().(); |
| 104 | } |
| 105 | } |
| 106 | } |
| 107 | |
| 108 | for row in (0..rust-analyzer cargo core https://github.com/rust-lang/rust/library/core ops/range/Range#qr.sizerust-analyzer cargo fast_qr 0.13.1 qr/QRCode#size.).step_byrust-analyzer cargo core https://github.com/rust-lang/rust/library/core iter/traits/iterator/Iterator#step_by().(6) { |
| 109 | for column in (0..rust-analyzer cargo core https://github.com/rust-lang/rust/library/core ops/range/Range#qr.sizerust-analyzer cargo fast_qr 0.13.1 qr/QRCode#size.).step_byrust-analyzer cargo core https://github.com/rust-lang/rust/library/core iter/traits/iterator/Iterator#step_by().(6) { |
| 110 | for (y, x) in offset { |
| 111 | if row rust-analyzer cargo core https://github.com/rust-lang/rust/library/core ops/arith/impl#[usize][`Add<&usize>`]add().+rust-analyzer cargo core https://github.com/rust-lang/rust/library/core ops/arith/impl#[usize][`Add<&usize>`]add(). rust-analyzer cargo core https://github.com/rust-lang/rust/library/core ops/arith/impl#[usize][`Add<&usize>`]add().y rust-analyzer cargo core https://github.com/rust-lang/rust/library/core cmp/impls/impl#[usize][`PartialOrd<Self>`]ge().>=rust-analyzer cargo core https://github.com/rust-lang/rust/library/core cmp/impls/impl#[usize][`PartialOrd<Self>`]ge(). rust-analyzer cargo core https://github.com/rust-lang/rust/library/core cmp/impls/impl#[usize][`PartialOrd<Self>`]ge().qr.sizerust-analyzer cargo fast_qr 0.13.1 qr/QRCode#size. || column rust-analyzer cargo core https://github.com/rust-lang/rust/library/core ops/arith/impl#[usize][`Add<&usize>`]add().+rust-analyzer cargo core https://github.com/rust-lang/rust/library/core ops/arith/impl#[usize][`Add<&usize>`]add(). rust-analyzer cargo core https://github.com/rust-lang/rust/library/core ops/arith/impl#[usize][`Add<&usize>`]add().x rust-analyzer cargo core https://github.com/rust-lang/rust/library/core cmp/impls/impl#[usize][`PartialOrd<Self>`]ge().>=rust-analyzer cargo core https://github.com/rust-lang/rust/library/core cmp/impls/impl#[usize][`PartialOrd<Self>`]ge(). rust-analyzer cargo core https://github.com/rust-lang/rust/library/core cmp/impls/impl#[usize][`PartialOrd<Self>`]ge().qr.sizerust-analyzer cargo fast_qr 0.13.1 qr/QRCode#size. { |
| 112 | continue; |
| 113 | } |
| 114 | |
| 115 | let module = &mut qr[rust-analyzer cargo core https://github.com/rust-lang/rust/library/core ops/index/IndexMut#index_mut().row rust-analyzer cargo core https://github.com/rust-lang/rust/library/core ops/arith/impl#[usize][`Add<&usize>`]add().+rust-analyzer cargo core https://github.com/rust-lang/rust/library/core ops/arith/impl#[usize][`Add<&usize>`]add(). rust-analyzer cargo core https://github.com/rust-lang/rust/library/core ops/arith/impl#[usize][`Add<&usize>`]add().y]rust-analyzer cargo core https://github.com/rust-lang/rust/library/core ops/index/IndexMut#index_mut().[rust-analyzer cargo core https://github.com/rust-lang/rust/library/core slice/index/impl#[`[T]`][`IndexMut<I>`]index_mut().column rust-analyzer cargo core https://github.com/rust-lang/rust/library/core ops/arith/impl#[usize][`Add<&usize>`]add().+rust-analyzer cargo core https://github.com/rust-lang/rust/library/core ops/arith/impl#[usize][`Add<&usize>`]add(). rust-analyzer cargo core https://github.com/rust-lang/rust/library/core ops/arith/impl#[usize][`Add<&usize>`]add().x]rust-analyzer cargo core https://github.com/rust-lang/rust/library/core slice/index/impl#[`[T]`][`IndexMut<I>`]index_mut().; |
| 116 | if module.module_typerust-analyzer cargo fast_qr 0.13.1 module/impl#[Module]module_type().() rust-analyzer cargo fast_qr 0.13.1 module/impl#[ModuleType][`PartialEq<Self>`]eq().==rust-analyzer cargo fast_qr 0.13.1 module/impl#[ModuleType][`PartialEq<Self>`]eq(). rust-analyzer cargo fast_qr 0.13.1 module/impl#[ModuleType][`PartialEq<Self>`]eq().ModuleTyperust-analyzer cargo fast_qr 0.13.1 module/ModuleType#::Datarust-analyzer cargo fast_qr 0.13.1 module/ModuleType#Data# { |
| 117 | module.togglerust-analyzer cargo fast_qr 0.13.1 module/impl#[Module]toggle().(); |
| 118 | } |
| 119 | } |
| 120 | } |
| 121 | } |
| 122 | } |
| 123 | |
| 124 | /// Mask function nb°**5**, `Mask::Fields`. |
| 125 | fn mask_fieldrust-analyzer cargo fast_qr 0.13.1 datamasking/mask_field().(qr: &mut QRCoderust-analyzer cargo fast_qr 0.13.1 qr/QRCode#) { |
| 126 | const OFFSETSrust-analyzer cargo fast_qr 0.13.1 datamasking/OFFSETS.: [(usize, usize); 4] = [(2, 3), (3, 2), (3, 4), (4, 3)]; |
| 127 | mask_5_6rust-analyzer cargo fast_qr 0.13.1 datamasking/mask_5_6().(qr, &OFFSETSrust-analyzer cargo fast_qr 0.13.1 datamasking/OFFSETS.); |
| 128 | } |
| 129 | |
| 130 | /// Mask function nb°**6**, `Mask::Diamonds`. |
| 131 | fn mask_diamondrust-analyzer cargo fast_qr 0.13.1 datamasking/mask_diamond().(qr: &mut QRCoderust-analyzer cargo fast_qr 0.13.1 qr/QRCode#) { |
| 132 | #[rustfmt::skip] |
| 133 | const OFFSETSrust-analyzer cargo fast_qr 0.13.1 datamasking/OFFSETS.: [(usize, usize); 12] = [ |
| 134 | (1, 1), (1, 2), (2, 1), (2, 3), |
| 135 | (2, 4), (3, 2), (3, 4), (4, 2), |
| 136 | (4, 3), (4, 5), (5, 4), (5, 5) |
| 137 | ]; |
| 138 | mask_5_6rust-analyzer cargo fast_qr 0.13.1 datamasking/mask_5_6().(qr, &OFFSETSrust-analyzer cargo fast_qr 0.13.1 datamasking/OFFSETS.); |
| 139 | } |
| 140 | |
| 141 | /// Mask function nb°**7**, `Mask::Meadow`. |
| 142 | fn mask_meadowrust-analyzer cargo fast_qr 0.13.1 datamasking/mask_meadow().(qr: &mut QRCoderust-analyzer cargo fast_qr 0.13.1 qr/QRCode#) { |
| 143 | for row in 0..rust-analyzer cargo core https://github.com/rust-lang/rust/library/core ops/range/Range#qr.sizerust-analyzer cargo fast_qr 0.13.1 qr/QRCode#size. { |
| 144 | for column in row..rust-analyzer cargo core https://github.com/rust-lang/rust/library/core ops/range/Range#qr.sizerust-analyzer cargo fast_qr 0.13.1 qr/QRCode#size. { |
| 145 | if (((row rust-analyzer cargo core https://github.com/rust-lang/rust/library/core ops/arith/impl#[usize][`Add<Self>`]add().+rust-analyzer cargo core https://github.com/rust-lang/rust/library/core ops/arith/impl#[usize][`Add<Self>`]add(). rust-analyzer cargo core https://github.com/rust-lang/rust/library/core ops/arith/impl#[usize][`Add<Self>`]add().column) rust-analyzer cargo core https://github.com/rust-lang/rust/library/core ops/arith/impl#[usize][`Rem<Self>`]rem().%rust-analyzer cargo core https://github.com/rust-lang/rust/library/core ops/arith/impl#[usize][`Rem<Self>`]rem(). rust-analyzer cargo core https://github.com/rust-lang/rust/library/core ops/arith/impl#[usize][`Rem<Self>`]rem().2) rust-analyzer cargo core https://github.com/rust-lang/rust/library/core ops/arith/impl#[usize][`Add<Self>`]add().+rust-analyzer cargo core https://github.com/rust-lang/rust/library/core ops/arith/impl#[usize][`Add<Self>`]add(). rust-analyzer cargo core https://github.com/rust-lang/rust/library/core ops/arith/impl#[usize][`Add<Self>`]add().((row rust-analyzer cargo core https://github.com/rust-lang/rust/library/core ops/arith/impl#[usize][`Mul<Self>`]mul().*rust-analyzer cargo core https://github.com/rust-lang/rust/library/core ops/arith/impl#[usize][`Mul<Self>`]mul(). rust-analyzer cargo core https://github.com/rust-lang/rust/library/core ops/arith/impl#[usize][`Mul<Self>`]mul().column) rust-analyzer cargo core https://github.com/rust-lang/rust/library/core ops/arith/impl#[usize][`Rem<Self>`]rem().%rust-analyzer cargo core https://github.com/rust-lang/rust/library/core ops/arith/impl#[usize][`Rem<Self>`]rem(). rust-analyzer cargo core https://github.com/rust-lang/rust/library/core ops/arith/impl#[usize][`Rem<Self>`]rem().3)) rust-analyzer cargo core https://github.com/rust-lang/rust/library/core ops/arith/impl#[usize][`Rem<Self>`]rem().%rust-analyzer cargo core https://github.com/rust-lang/rust/library/core ops/arith/impl#[usize][`Rem<Self>`]rem(). rust-analyzer cargo core https://github.com/rust-lang/rust/library/core ops/arith/impl#[usize][`Rem<Self>`]rem().2 rust-analyzer cargo core https://github.com/rust-lang/rust/library/core cmp/impls/impl#[usize][`PartialEq<Self>`]ne().!=rust-analyzer cargo core https://github.com/rust-lang/rust/library/core cmp/impls/impl#[usize][`PartialEq<Self>`]ne(). rust-analyzer cargo core https://github.com/rust-lang/rust/library/core cmp/impls/impl#[usize][`PartialEq<Self>`]ne().0 { |
| 146 | continue; |
| 147 | } |
| 148 | |
| 149 | let module = &mut qr[rust-analyzer cargo core https://github.com/rust-lang/rust/library/core ops/index/IndexMut#index_mut().row]rust-analyzer cargo core https://github.com/rust-lang/rust/library/core ops/index/IndexMut#index_mut().[rust-analyzer cargo core https://github.com/rust-lang/rust/library/core slice/index/impl#[`[T]`][`IndexMut<I>`]index_mut().column]rust-analyzer cargo core https://github.com/rust-lang/rust/library/core slice/index/impl#[`[T]`][`IndexMut<I>`]index_mut().; |
| 150 | if module.module_typerust-analyzer cargo fast_qr 0.13.1 module/impl#[Module]module_type().() rust-analyzer cargo fast_qr 0.13.1 module/impl#[ModuleType][`PartialEq<Self>`]eq().==rust-analyzer cargo fast_qr 0.13.1 module/impl#[ModuleType][`PartialEq<Self>`]eq(). rust-analyzer cargo fast_qr 0.13.1 module/impl#[ModuleType][`PartialEq<Self>`]eq().ModuleTyperust-analyzer cargo fast_qr 0.13.1 module/ModuleType#::Datarust-analyzer cargo fast_qr 0.13.1 module/ModuleType#Data# { |
| 151 | module.togglerust-analyzer cargo fast_qr 0.13.1 module/impl#[Module]toggle().(); |
| 152 | } |
| 153 | |
| 154 | let module = &mut qr[rust-analyzer cargo core https://github.com/rust-lang/rust/library/core ops/index/IndexMut#index_mut().column]rust-analyzer cargo core https://github.com/rust-lang/rust/library/core ops/index/IndexMut#index_mut().[rust-analyzer cargo core https://github.com/rust-lang/rust/library/core slice/index/impl#[`[T]`][`IndexMut<I>`]index_mut().row]rust-analyzer cargo core https://github.com/rust-lang/rust/library/core slice/index/impl#[`[T]`][`IndexMut<I>`]index_mut().; |
| 155 | if column rust-analyzer cargo core https://github.com/rust-lang/rust/library/core cmp/impls/impl#[usize][`PartialEq<Self>`]ne().!=rust-analyzer cargo core https://github.com/rust-lang/rust/library/core cmp/impls/impl#[usize][`PartialEq<Self>`]ne(). rust-analyzer cargo core https://github.com/rust-lang/rust/library/core cmp/impls/impl#[usize][`PartialEq<Self>`]ne().row && module.module_typerust-analyzer cargo fast_qr 0.13.1 module/impl#[Module]module_type().() rust-analyzer cargo fast_qr 0.13.1 module/impl#[ModuleType][`PartialEq<Self>`]eq().==rust-analyzer cargo fast_qr 0.13.1 module/impl#[ModuleType][`PartialEq<Self>`]eq(). rust-analyzer cargo fast_qr 0.13.1 module/impl#[ModuleType][`PartialEq<Self>`]eq().ModuleTyperust-analyzer cargo fast_qr 0.13.1 module/ModuleType#::Datarust-analyzer cargo fast_qr 0.13.1 module/ModuleType#Data# { |
| 156 | module.togglerust-analyzer cargo fast_qr 0.13.1 module/impl#[Module]toggle().(); |
| 157 | } |
| 158 | } |
| 159 | } |
| 160 | } |
| 161 | |
| 162 | /// Applies the function at `mask_nb` on `mat` |
| 163 | pub fn maskrust-analyzer cargo fast_qr 0.13.1 datamasking/mask().(qr: &mut QRCoderust-analyzer cargo fast_qr 0.13.1 qr/QRCode#, mask: Maskrust-analyzer cargo fast_qr 0.13.1 datamasking/Mask#) { |
| 164 | match mask { |
| 165 | Maskrust-analyzer cargo fast_qr 0.13.1 datamasking/Mask#::Checkerboardrust-analyzer cargo fast_qr 0.13.1 datamasking/Mask#Checkerboard# => mask_checkerboardrust-analyzer cargo fast_qr 0.13.1 datamasking/mask_checkerboard().(qr), |
| 166 | Maskrust-analyzer cargo fast_qr 0.13.1 datamasking/Mask#::HorizontalLinesrust-analyzer cargo fast_qr 0.13.1 datamasking/Mask#HorizontalLines# => mask_horizontalrust-analyzer cargo fast_qr 0.13.1 datamasking/mask_horizontal().(qr), |
| 167 | Maskrust-analyzer cargo fast_qr 0.13.1 datamasking/Mask#::VerticalLinesrust-analyzer cargo fast_qr 0.13.1 datamasking/Mask#VerticalLines# => mask_verticalrust-analyzer cargo fast_qr 0.13.1 datamasking/mask_vertical().(qr), |
| 168 | Maskrust-analyzer cargo fast_qr 0.13.1 datamasking/Mask#::DiagonalLinesrust-analyzer cargo fast_qr 0.13.1 datamasking/Mask#DiagonalLines# => mask_diagonalrust-analyzer cargo fast_qr 0.13.1 datamasking/mask_diagonal().(qr), |
| 169 | Maskrust-analyzer cargo fast_qr 0.13.1 datamasking/Mask#::LargeCheckerboardrust-analyzer cargo fast_qr 0.13.1 datamasking/Mask#LargeCheckerboard# => mask_large_checkerboardrust-analyzer cargo fast_qr 0.13.1 datamasking/mask_large_checkerboard().(qr), |
| 170 | Maskrust-analyzer cargo fast_qr 0.13.1 datamasking/Mask#::Fieldsrust-analyzer cargo fast_qr 0.13.1 datamasking/Mask#Fields# => mask_fieldrust-analyzer cargo fast_qr 0.13.1 datamasking/mask_field().(qr), |
| 171 | Maskrust-analyzer cargo fast_qr 0.13.1 datamasking/Mask#::Diamondsrust-analyzer cargo fast_qr 0.13.1 datamasking/Mask#Diamonds# => mask_diamondrust-analyzer cargo fast_qr 0.13.1 datamasking/mask_diamond().(qr), |
| 172 | Maskrust-analyzer cargo fast_qr 0.13.1 datamasking/Mask#::Meadowrust-analyzer cargo fast_qr 0.13.1 datamasking/Mask#Meadow# => mask_meadowrust-analyzer cargo fast_qr 0.13.1 datamasking/mask_meadow().(qr), |
| 173 | } |
| 174 | } |