pub enum Module {
Empty,
Masked(Color),
Unmasked(Color),
}Expand description
The color of a module (pixel) in the QR code.
Variants§
Empty
The module is empty.
Masked(Color)
The module is of functional patterns which cannot be masked, or pixels which have been masked.
Unmasked(Color)
The module is of data and error correction bits before masking.
Implementations§
Source§impl Module
impl Module
Sourcepub fn mask(self, should_invert: bool) -> Module
pub fn mask(self, should_invert: bool) -> Module
Apply a mask to the unmasked modules.
use qrcode_core::canvas::Module;
use qrcode_core::types::Color;
assert_eq!(Module::Unmasked(Color::Light).mask(true), Module::Masked(Color::Dark));
assert_eq!(Module::Unmasked(Color::Dark).mask(true), Module::Masked(Color::Light));
assert_eq!(Module::Unmasked(Color::Light).mask(false), Module::Masked(Color::Light));
assert_eq!(Module::Masked(Color::Dark).mask(true), Module::Masked(Color::Dark));
assert_eq!(Module::Masked(Color::Dark).mask(false), Module::Masked(Color::Dark));Trait Implementations§
impl Copy for Module
impl Eq for Module
impl StructuralPartialEq for Module
Auto Trait Implementations§
impl Freeze for Module
impl RefUnwindSafe for Module
impl Send for Module
impl Sync for Module
impl Unpin for Module
impl UnsafeUnpin for Module
impl UnwindSafe for Module
Blanket Implementations§
Source§impl<T> BorrowMut<T> for Twhere
T: ?Sized,
impl<T> BorrowMut<T> for Twhere
T: ?Sized,
Source§fn borrow_mut(&mut self) -> &mut T
fn borrow_mut(&mut self) -> &mut T
Mutably borrows from an owned value. Read more
Source§impl<T> CloneToUninit for Twhere
T: Clone,
impl<T> CloneToUninit for Twhere
T: Clone,
Source§impl<Q, K> Equivalent<K> for Q
impl<Q, K> Equivalent<K> for Q
Source§fn equivalent(&self, key: &K) -> bool
fn equivalent(&self, key: &K) -> bool
Compare self to
key and return true if they are equal.