pub trait BitBoard: Sized {
Show 18 methods
// Required methods
fn n_rows(&self) -> usize;
fn n_cols(&self) -> usize;
fn board_mut(&mut self) -> &mut BitSlice ⓘ;
fn board(&self) -> &BitSlice ⓘ;
fn or(&self, other: &impl BitBoard) -> Result<Self, DimensionMismatch>;
fn and(&self, other: &impl BitBoard) -> Result<Self, DimensionMismatch>;
// Provided methods
fn index_of(&self, row: usize, col: usize) -> usize { ... }
fn row_col_of(&self, index: usize) -> (usize, usize) { ... }
fn fill(&mut self, value: bool) { ... }
fn set(&mut self, row: usize, col: usize, value: bool) { ... }
fn get(&self, row: usize, col: usize) -> bool { ... }
fn set_col(&mut self, col: usize, value: bool) { ... }
fn get_col(&self, col: usize) -> impl Iterator<Item = bool> { ... }
fn set_row(&mut self, row: usize, value: bool) { ... }
fn get_row(&self, row: usize) -> impl Iterator<Item = bool> { ... }
fn set_cardinal_neighbors(&mut self, row: usize, col: usize, value: bool) { ... }
fn set_diagonals(&mut self, row: usize, col: usize, value: bool) { ... }
fn set_all_neighbors(&mut self, row: usize, col: usize, value: bool) { ... }
}Required Methods§
fn or(&self, other: &impl BitBoard) -> Result<Self, DimensionMismatch>
fn and(&self, other: &impl BitBoard) -> Result<Self, DimensionMismatch>
Provided Methods§
Sourcefn index_of(&self, row: usize, col: usize) -> usize
fn index_of(&self, row: usize, col: usize) -> usize
Get the index that we can use to directly access a certain spot on the board
Sourcefn row_col_of(&self, index: usize) -> (usize, usize)
fn row_col_of(&self, index: usize) -> (usize, usize)
Get the row and column of the linear index
Sourcefn set(&mut self, row: usize, col: usize, value: bool)
fn set(&mut self, row: usize, col: usize, value: bool)
Set the value at index [row, col] to be the new_val.
Sourcefn get(&self, row: usize, col: usize) -> bool
fn get(&self, row: usize, col: usize) -> bool
Get the value at index [row, col]. If the index is out of bounds, return false.
Sourcefn set_cardinal_neighbors(&mut self, row: usize, col: usize, value: bool)
fn set_cardinal_neighbors(&mut self, row: usize, col: usize, value: bool)
Will set the neighbors immediately above, below, left, and right to value. If
the neighbor is out of bounds, nothing will happen
Sourcefn set_diagonals(&mut self, row: usize, col: usize, value: bool)
fn set_diagonals(&mut self, row: usize, col: usize, value: bool)
Set just the spots diagonal from the given position to value. If
the neighbor is out of bounds, nothing will happen
Sourcefn set_all_neighbors(&mut self, row: usize, col: usize, value: bool)
fn set_all_neighbors(&mut self, row: usize, col: usize, value: bool)
Set the cardinal neighbors and the diagonal neighbors to value. If
the neighbor is out of bounds, nothing will happen
Dyn Compatibility§
This trait is not dyn compatible.
In older versions of Rust, dyn compatibility was called "object safety", so this trait is not object safe.