[][src]Struct rqr::matrix::Matrix

pub struct Matrix {
    pub size: usize,
    pub modules: Vec<Module>,
}

Matrix is a 2-dimensional grid holding the QR modules.

Fields

size: usize

Size defines the width and height of the matrix.

modules: Vec<Module>

The modules.

Methods

impl Matrix[src]

pub fn new(size: usize) -> Matrix[src]

Create a new matrix, modules initialized to Unknown.

pub fn index(&self, x: usize, y: usize) -> usize[src]

Map (x,y) coords to linear index.

pub fn get(&self, x: usize, y: usize) -> &Module[src]

Get module.

pub fn get_mut(&mut self, x: usize, y: usize) -> &mut Module[src]

Get mutable module.

pub fn is_dark(&self, x: usize, y: usize) -> bool[src]

Returns true if the module at x,y is dark.

pub fn is_fun(&self, x: usize, y: usize) -> bool[src]

Return true if the module at x,y is a function module.

pub fn is_data(&self, x: usize, y: usize) -> bool[src]

Return true if the module at x,y contains data.

pub fn set(&mut self, x: usize, y: usize, v: Module)[src]

Assign a module.

pub fn set_fun(&mut self, x: usize, y: usize, v: bool)[src]

Assign a function module. Fails if the existing module is a Data module.

pub fn set_data(&mut self, x: usize, y: usize, v: bool)[src]

Assign a data module. Fails unless the existing module is Unknown.

pub fn flip(&mut self, x: usize, y: usize)[src]

Flip a module. Fails unless it's a data module.

pub fn set_square_outline(&mut self, x: usize, y: usize, w: usize, v: Module)[src]

Set square outline.

pub fn set_square(&mut self, x: usize, y: usize, w: usize, v: Module)[src]

Set square.

pub fn set_rect(
    &mut self,
    x0: usize,
    y0: usize,
    x1: usize,
    y1: usize,
    v: Module
)
[src]

Set rect.

pub fn any_in_square(&self, x: usize, y: usize, w: usize) -> bool[src]

Return true if there's any module other than Unknown in square.

pub fn any_in_rect(&self, x0: usize, y0: usize, x1: usize, y1: usize) -> bool[src]

Return true if there's any module other than Unknown in rect.

pub fn complete(&self) -> bool[src]

Return true if the matrix is complete, that's if it only contains Data or Function modules.

Trait Implementations

impl Eq for Matrix[src]

impl PartialEq<Matrix> for Matrix[src]

impl Clone for Matrix[src]

default fn clone_from(&mut self, source: &Self)
1.0.0
[src]

Performs copy-assignment from source. Read more

impl Debug for Matrix[src]

Auto Trait Implementations

impl Send for Matrix

impl Sync for Matrix

Blanket Implementations

impl<T> ToOwned for T where
    T: Clone
[src]

type Owned = T

impl<T> From for T[src]

impl<T, U> Into for T where
    U: From<T>, 
[src]

impl<T, U> TryFrom for T where
    U: Into<T>, 
[src]

type Error = Infallible

The type returned in the event of a conversion error.

impl<T> Borrow for T where
    T: ?Sized
[src]

impl<T> Any for T where
    T: 'static + ?Sized
[src]

impl<T> BorrowMut for T where
    T: ?Sized
[src]

impl<T, U> TryInto for T where
    U: TryFrom<T>, 
[src]

type Error = <U as TryFrom<T>>::Error

The type returned in the event of a conversion error.