[−][src]Struct gridly_grids::VecGrid
A grid that stores its elements in a Vec<T>
, in row-major order.
Methods
impl<T> VecGrid<T>
[src]
pub fn new_fill_with(
dimensions: impl Into<Vector>,
gen: impl FnMut() -> T
) -> Option<Self>
[src]
dimensions: impl Into<Vector>,
gen: impl FnMut() -> T
) -> Option<Self>
Create a new VecGrid
, filled with elements by repeatedly calling a function
pub fn new_with(
dimensions: impl Into<Vector>,
gen: impl FnMut(&Location) -> T
) -> Option<Self>
[src]
dimensions: impl Into<Vector>,
gen: impl FnMut(&Location) -> T
) -> Option<Self>
Create a new VecGrid
by calling a function for each location in the
grid
impl<T: Default> VecGrid<T>
[src]
pub fn new(dimensions: impl Into<Vector>) -> Option<Self>
[src]
Create a new VecGrid
filled with the default value of T
in each cell
impl<T: Clone> VecGrid<T>
[src]
pub fn new_fill(dimensions: impl Into<Vector>, value: &T) -> Option<Self>
[src]
Create a new VecGrid
filled with clones of value
Trait Implementations
impl<T: Clone> Clone for VecGrid<T>
[src]
fn clone(&self) -> VecGrid<T>
[src]
default fn clone_from(&mut self, source: &Self)
1.0.0[src]
Performs copy-assignment from source
. Read more
impl<T: Debug> Debug for VecGrid<T>
[src]
impl<T> GridBounds for VecGrid<T>
[src]
fn dimensions(&self) -> Vector
[src]
default fn root(&self) -> Location
[src]
Return the root location (ie, the top left) of the grid. For most grids, this is (0, 0), but some grids may include negatively indexed locations, or even offsets. This value MUST be const for any given grid. Read more
impl<T> BaseGrid for VecGrid<T>
[src]
type Item = T
unsafe fn get_unchecked(&self, loc: &Location) -> &T
[src]
impl<T> BaseGridMut for VecGrid<T>
[src]
unsafe fn get_unchecked_mut(&mut self, loc: &Location) -> &mut T
[src]
unsafe default fn set_unchecked(&mut self, loc: &Location, value: Self::Item)
[src]
Set the value of a cell in a location, without bounds checking the location.
Auto Trait Implementations
Blanket Implementations
impl<T, U> Into for T where
U: From<T>,
[src]
U: From<T>,
impl<T> From for T
[src]
impl<T> ToOwned for T where
T: Clone,
[src]
T: Clone,
impl<T, U> TryFrom for T where
U: Into<T>,
[src]
U: Into<T>,
type Error = Infallible
The type returned in the event of a conversion error.
fn try_from(value: U) -> Result<T, <T as TryFrom<U>>::Error>
[src]
impl<T> Borrow for T where
T: ?Sized,
[src]
T: ?Sized,
impl<T> BorrowMut for T where
T: ?Sized,
[src]
T: ?Sized,
fn borrow_mut(&mut self) -> &mut T
[src]
impl<T, U> TryInto for T where
U: TryFrom<T>,
[src]
U: TryFrom<T>,
type Error = <U as TryFrom<T>>::Error
The type returned in the event of a conversion error.
fn try_into(self) -> Result<U, <U as TryFrom<T>>::Error>
[src]
impl<T> Any for T where
T: 'static + ?Sized,
[src]
T: 'static + ?Sized,
impl<G> IntoTranspose for G where
G: GridBounds,
[src]
G: GridBounds,
impl<G> GridBoundsExt for G where
G: GridBounds,
[src]
G: GridBounds,
default fn num_rows(&self) -> Rows
[src]
Get the height of the grid in [Rows
]. This value MUST be const for any given grid. Read more
default fn num_columns(&self) -> Columns
[src]
Get the width of the grid, in [Columns
]. This value MUST be const for any given grid. Read more
default fn dimension<C>(&self) -> C where
C: Component,
[src]
C: Component,
Get the height or width of this grid.
default fn root_row(&self) -> Row
[src]
Return the index of the topmost row of this grid. For most grids, this is 0, but some grids may include negatively indexed locations, or even offsets. This value MUST be const for any given grid. Read more
default fn root_column(&self) -> Column
[src]
Return the index of the leftmost column of this grid. For most grids, this is 0, but some grids may include negatively indexed locations, or even offsets. This value MUST be const for any given grid. Read more
default fn root_component<C>(&self) -> C where
C: Component,
[src]
C: Component,
Return the index of the leftmost row or column of this grid.
default fn range<C>(&self) -> Range<C> where
C: Component,
[src]
C: Component,
Get a Range over the row or column indexes
default fn row_range(&self) -> Range<Row>
[src]
A range iterator over all the column indexes in this grid
default fn column_range(&self) -> Range<Column>
[src]
A range iterator over all the row indexes in this grid
default fn check_component<C>(&self, c: C) -> Result<C, RangeError<C>> where
C: Component,
[src]
C: Component,
Check that a Row or a Column is inside the bounds described by this Grid.
default fn component_in_bounds<C>(&self, c: C) -> bool where
C: Component,
[src]
C: Component,
default fn check_location<impl Into>(
&self,
loc: impl Into
) -> Result<Location, LocationRangeError> where
impl Into: Into<Location>,
[src]
&self,
loc: impl Into
) -> Result<Location, LocationRangeError> where
impl Into
Check that a location is inside the bounds of this grid. Read more
default fn location_in_bounds<impl Into>(
&self,
location: impl Into
) -> bool where
impl Into: Into<Location>,
[src]
&self,
location: impl Into
) -> bool where
impl Into
Returns true if a locaton is inside the bounds of this grid.
impl<G> Grid for G where
G: BaseGrid,
[src]
G: BaseGrid,
default fn get<impl Into>(
&self,
location: impl Into
) -> Result<&Self::Item, LocationRangeError> where
impl Into: Into<Location>,
[src]
&self,
location: impl Into
) -> Result<&Self::Item, LocationRangeError> where
impl Into
Get a reference to a cell in a grid. Returns an error if the location is out of bounds with the specific boundary violation. Read more
default fn view<T>(&self) -> View<Self, T> where
T: Component,
[src]
T: Component,
default fn rows(&self) -> View<Self, Row>
[src]
Get a view of a grid's rows
default fn columns(&self) -> View<Self, Column>
[src]
Get a view of a grid's columns
unsafe default fn single_view_unchecked<T>(
&self,
index: T
) -> SingleView<Self, T> where
T: Component,
[src]
&self,
index: T
) -> SingleView<Self, T> where
T: Component,
Get a view of a single row or column in a grid, without bounds checking that row or column index. Read more
unsafe default fn row_unchecked<impl Into>(
&self,
row: impl Into
) -> SingleView<Self, Row> where
impl Into: Into<Row>,
|
[src]
&self,
row: impl Into
) -> SingleView<Self, Row> where
impl Into
Get a view of a single row in a grid, without bounds checking that row's index
unsafe default fn column_unchecked<impl Into>(
&self,
column: impl Into
) -> SingleView<Self, Column> where
impl Into: Into<Column>,
[src]
&self,
column: impl Into
) -> SingleView<Self, Column> where
impl Into
Get a view of a single column in a grid, without bounds checking that column's index
default fn single_view<T>(
&self,
index: T
) -> Result<SingleView<Self, T>, RangeError<T>> where
T: Component,
[src]
&self,
index: T
) -> Result<SingleView<Self, T>, RangeError<T>> where
T: Component,
Get a view of a single row or column in a grid. Returns an error if the index of the row or column is out of bounds for the grid. Read more
default fn row<impl Into>(
&self,
row: impl Into
) -> Result<SingleView<Self, Row>, RangeError<Row>> where
impl Into: Into<Row>,
|
[src]
&self,
row: impl Into
) -> Result<SingleView<Self, Row>, RangeError<Row>> where
impl Into
Get a view of a single row in a grid. Returns an error if the index of the row is out of bounds for the grid. Read more
default fn column<impl Into>(
&self,
column: impl Into
) -> Result<SingleView<Self, Column>, RangeError<Column>> where
impl Into: Into<Column>,
[src]
&self,
column: impl Into
) -> Result<SingleView<Self, Column>, RangeError<Column>> where
impl Into
Get a view of a single column in a grid. Returns an error if the index of the column is out of bounds for the grid. Read more
impl<G> GridMut for G where
G: BaseGridMut,
[src]
G: BaseGridMut,