pub struct BitMatrix { /* private fields */ }Expand description
A rectangular grid of dark (true) and light (false) modules.
The Debug implementation renders ASCII art, which makes failing tests
readable at a glance.
Implementations§
Source§impl BitMatrix
impl BitMatrix
Sourcepub fn new(width: u32, height: u32) -> Self
pub fn new(width: u32, height: u32) -> Self
Create an all-light matrix.
§Panics
Panics if width or height is zero, which no symbology should ever
produce.
Sourcepub fn from_vec(width: u32, height: u32, bits: Vec<bool>) -> Option<Self>
pub fn from_vec(width: u32, height: u32, bits: Vec<bool>) -> Option<Self>
Build a matrix from row-major module data.
Returns None if bits.len() is not exactly width * height, or if
either dimension is zero.
Sourcepub fn get(&self, x: u32, y: u32) -> bool
pub fn get(&self, x: u32, y: u32) -> bool
Whether the module at (x, y) is dark. Out-of-bounds reads as light.
Trait Implementations§
impl Eq for BitMatrix
impl StructuralPartialEq for BitMatrix
Auto Trait Implementations§
impl Freeze for BitMatrix
impl RefUnwindSafe for BitMatrix
impl Send for BitMatrix
impl Sync for BitMatrix
impl Unpin for BitMatrix
impl UnsafeUnpin for BitMatrix
impl UnwindSafe for BitMatrix
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