pub struct Grid {
pub rows: usize,
pub tile_cost: NonZeroUsize,
}Expand description
A grid that Strategy::run_tiles can cut, made of rows passes over the run’s columns.
Finishing a tile costs a fixed tile_cost cells.
A tile is one row over a contiguous range of columns, and a run pays tile_cost once per
tile, so every cut of a row adds a finish. Three rows over eight columns, as a serial run
and as two workers A and B might cut them ([ ] marks a tile):
serial whole rows shares of cells
row 0 [A A A A A A A A] [A A A A A A A A] [A A A A A A A A]
row 1 [A A A A A A A A] [B B B B B B B B] [A A A A][B B B B]
row 2 [A A A A A A A A] [A A A A A A A A] [B B B B B B B B]
3 tiles on the 3 tiles: A claimed 4 tiles: 12 cells and
calling thread row 2 after row 0 2 finishes per workerHere whole rows leave A 16 cells and two finishes against B’s eight and one, while
shares balance the cells at the price of a cut in row 1. Which cut finishes first depends on
tile_cost, and Tiles describes how a run chooses and how workers claim.
Fields§
§rows: usizePasses over the columns.
tile_cost: NonZeroUsizeThe cost of finishing a tile, in cells.
Trait Implementations§
impl Copy for Grid
impl Eq for Grid
impl StructuralPartialEq for Grid
Auto Trait Implementations§
impl Freeze for Grid
impl RefUnwindSafe for Grid
impl Send for Grid
impl Sync for Grid
impl Unpin for Grid
impl UnsafeUnpin 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