pub struct Grid { /* private fields */ }Expand description
Dancing links grid, support efficient removal of rows and columns.
Implementations§
Source§impl Grid
impl Grid
Sourcepub fn new(
num_columns: usize,
coordinates: impl IntoIterator<Item = (usize, usize)>,
) -> Self
pub fn new( num_columns: usize, coordinates: impl IntoIterator<Item = (usize, usize)>, ) -> Self
Create a new grid with a specified number of columns, and the given coordinates filled.
Rows and columns are based 1 indexed for this grid, matching the indexing notation for matrices in general.
Sourcepub fn to_dense(&self) -> Box<[Box<[bool]>]>
pub fn to_dense(&self) -> Box<[Box<[bool]>]>
Convert the grid to a dense representation.
This takes the original size of the grid, and only put true values for
locations that are still present in the grid (not covered).
Sourcepub fn uncovered_columns(&self) -> impl Iterator<Item = *const Column>
pub fn uncovered_columns(&self) -> impl Iterator<Item = *const Column>
Return an iterator of pointers to columns that are uncovered.
Sourcepub fn uncovered_columns_mut(&mut self) -> impl Iterator<Item = *mut Column>
pub fn uncovered_columns_mut(&mut self) -> impl Iterator<Item = *mut Column>
Return an iterator of mut pointers to columns that are uncovered.
Sourcepub fn all_columns_mut(
&mut self,
) -> impl DoubleEndedIterator<Item = *mut Column> + '_
pub fn all_columns_mut( &mut self, ) -> impl DoubleEndedIterator<Item = *mut Column> + '_
Return an iterator over all columns that are in the grid (covered and uncovered).
Sourcepub fn get_column(&self, index: usize) -> Option<*const Column>
pub fn get_column(&self, index: usize) -> Option<*const Column>
Return a pointer to a specific Column, if it exists.
Trait Implementations§
Auto Trait Implementations§
impl !Freeze for Grid
impl !RefUnwindSafe for Grid
impl !Send for Grid
impl !Sync for Grid
impl Unpin for Grid
impl !UnwindSafe for Grid
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