[−][src]Struct rqr::matrix::Matrix
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]
&mut self,
x0: usize,
y0: usize,
x1: usize,
y1: usize,
v: Module
)
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 Clone for Matrix
[src]
fn clone(&self) -> Matrix
[src]
default fn clone_from(&mut self, source: &Self)
1.0.0[src]
Performs copy-assignment from source
. Read more
impl PartialEq<Matrix> for Matrix
[src]
impl Eq for Matrix
[src]
impl Debug for Matrix
[src]
Auto Trait Implementations
Blanket Implementations
impl<T> ToOwned for T where
T: Clone,
[src]
T: Clone,
impl<T, U> Into for T where
U: From<T>,
[src]
U: From<T>,
impl<T> From for T
[src]
impl<T, U> TryFrom for T where
U: Into<T>,
[src]
U: Into<T>,
type Error = Infallible
The type returned in the event of a conversion error.
fn try_from(value: U) -> Result<T, <T as TryFrom<U>>::Error>
[src]
impl<T> Borrow for T where
T: ?Sized,
[src]
T: ?Sized,
impl<T> Any for T where
T: 'static + ?Sized,
[src]
T: 'static + ?Sized,
impl<T> BorrowMut for T where
T: ?Sized,
[src]
T: ?Sized,
fn borrow_mut(&mut self) -> &mut T
[src]
impl<T, U> TryInto for T where
U: TryFrom<T>,
[src]
U: TryFrom<T>,