Enum qrcode::canvas::Module [] [src]

pub enum Module {
    Empty,
    Light,
    Dark,
    LightUnmasked,
    DarkUnmasked,
}

The color of a module (pixel) in the QR code.

Variants

Empty

The module is empty.

Light

The module is light (white), and cannot be masked. This mainly refers to modules of functional patterns.

Dark

The module is dark (black), and cannot be masked. This mainly refers to modules of functional patterns.

LightUnmasked

The module is light (white), but not yet masked. This mainly refers to modules of data and error correction bits before masking.

DarkUnmasked

The module is dark (black), but not yet masked. This mainly refers to modules of data and error correction bits before masking.

Methods

impl Module
[src]

fn is_dark(&self) -> bool

Checks whether a module is dark.

fn mask(&self, should_invert: bool) -> Module

Apply a mask to the unmasked modules.

use qrcode::canvas::Module;

assert_eq!(Module::LightUnmasked.mask(true), Module::Dark);
assert_eq!(Module::DarkUnmasked.mask(true), Module::Light);
assert_eq!(Module::LightUnmasked.mask(false), Module::Light);
assert_eq!(Module::Dark.mask(true), Module::Dark);
assert_eq!(Module::Dark.mask(false), Module::Dark);

Trait Implementations

Derived Implementations

impl Debug for Module
[src]

fn fmt(&self, __arg_0: &mut Formatter) -> Result

Formats the value using the given formatter.

impl Copy for Module
[src]

impl Clone for Module
[src]

fn clone(&self) -> Module

Returns a copy of the value. Read more

fn clone_from(&mut self, source: &Self)
1.0.0

Performs copy-assignment from source. Read more

impl Eq for Module
[src]

impl PartialEq for Module
[src]

fn eq(&self, __arg_0: &Module) -> bool

This method tests for self and other values to be equal, and is used by ==. Read more

fn ne(&self, other: &Rhs) -> bool
1.0.0

This method tests for !=.