[][src]Struct gridly_grids::VecGrid

pub struct VecGrid<T> { /* fields omitted */ }

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]

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]

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]

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]

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

impl<T> BaseGridMut for VecGrid<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

impl<T> Send for VecGrid<T> where
    T: Send

impl<T> Sync for VecGrid<T> where
    T: Sync

Blanket Implementations

impl<T, U> Into for T where
    U: From<T>, 
[src]

impl<T> From for T[src]

impl<T> ToOwned for T where
    T: Clone
[src]

type Owned = T

impl<T, U> TryFrom for T where
    U: Into<T>, 
[src]

type Error = Infallible

The type returned in the event of a conversion error.

impl<T> Borrow for T where
    T: ?Sized
[src]

impl<T> BorrowMut for T where
    T: ?Sized
[src]

impl<T, U> TryInto for T where
    U: TryFrom<T>, 
[src]

type Error = <U as TryFrom<T>>::Error

The type returned in the event of a conversion error.

impl<T> Any for T where
    T: 'static + ?Sized
[src]

impl<G> IntoTranspose for G where
    G: GridBounds
[src]

impl<G> GridBoundsExt for G where
    G: GridBounds
[src]

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]

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]

Return the index of the leftmost row or column of this grid.

default fn range<C>(&self) -> Range<C> where
    C: Component
[src]

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]

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]

default fn check_location<impl Into>(
    &self,
    loc: impl Into
) -> Result<Location, LocationRangeError> where
    impl Into: Into<Location>, 
[src]

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]

Returns true if a locaton is inside the bounds of this grid.

impl<G> Grid for G where
    G: BaseGrid
[src]

default fn get<impl Into>(
    &self,
    location: impl Into
) -> Result<&Self::Item, LocationRangeError> where
    impl Into: Into<Location>, 
[src]

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]

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]

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]

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]

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]

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]

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]

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]

default fn get_mut<impl Into>(
    &mut self,
    location: impl Into
) -> Result<&mut Self::Item, LocationRangeError> where
    impl Into: Into<Location>, 
[src]

default fn set<impl Into>(
    &mut self,
    location: impl Into,
    value: Self::Item
) -> Result<(), LocationRangeError> where
    impl Into: Into<Location>, 
[src]