pub fn new(num_columns: usize, coordinates: impl IntoIterator<Item = (usize, usize)>) -> Self {
        let arena = bumpalo::Bump::new();
        let root = Column::new(&arena, 0);
        let columns = once(root)
            .chain((1..=num_columns).map(|idx| Column::new(&arena, idx)))
            .collect::<Vec<_>>();

        // Chain all the columns together, including the sentinel root column.
        for idx in 0..columns.len() {
            let next_idx = (idx + 1) % columns.len();
            let column = columns[idx];
            let next_column = columns[next_idx];

            Column::add_right(column, next_column);
        }

        let mut grid = Grid {
            root,
            columns,
            arena,
            num_columns,
            max_row: 0,
        };

        grid.add_all_coordinates(coordinates);

        grid
    }
/// 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.
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.
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 .
pub fn new(num_columns: usize, coordinates: impl IntoIterator<Item = (usize, usize)>) -> Self {
        let arena = bumpalo::Bump::new();
        let root = Column::new(&arena, 0);
        let columns = once(root)
            .chain((1..=num_columns).map(|idx| Column::new(&arena, idx)))
            .collect::<Vec<_>>();
        // Chain all the columns together, including the sentinel root column.
        for idx in 0..columns.len() {
            let next_idx = (idx + 1) % columns.len();
            let column = columns[idx];
            let next_column = columns[next_idx];
            Column::add_right(column, next_column);
        }
        let mut grid = Grid {
            root,
            columns,
            arena,
            num_columns,
            max_row: 0,
        };
        grid.add_all_coordinates(coordinates);
        grid
    }
pub fn new ( num_columns : usize , coordinates : impl IntoIterator < Item = ( usize , usize ) > ) -> Self { let arena = bumpalo :: Bump :: new ( ) ; let root = Column :: new ( & arena , 0 ) ; let columns = once ( root ) . chain ( ( 1 ..= num_columns ) . map ( | idx | Column :: new ( & arena , idx ) ) ) . collect :: < Vec < _ > > ( ) ; // Chain all the columns together, including the sentinel root column. for idx in 0 .. columns . len ( ) { let next_idx = ( idx + 1 ) % columns . len ( ) ; let column = columns [ idx ] ; let next_column = columns [ next_idx ] ; Column :: add_right ( column , next_column ) ; } let mut grid = Grid { root , columns , arena , num_columns , max_row : 0 , } ; grid . add_all_coordinates ( coordinates ) ; grid }
Create a new grid with a specified number of columns, and the given
coordinates filled.
Create a new grid with a specified number of columns and the given coordinates filled .
num_columns
usize
coordinates
impl IntoIterator<Item = (usize, usize)>
num_columns
usize
coordinates
impl IntoIterator<Item = (usize, usize)>