[][src]Struct gridly_grids::SparseGrid

pub struct SparseGrid<T: Clone + PartialEq> { /* fields omitted */ }

Methods

impl<T: Clone + PartialEq> SparseGrid<T>[src]

pub fn new(dimensions: Vector, default: T) -> Self[src]

pub fn new_rooted(root: Location, dimensions: Vector, default: T) -> Self[src]

pub fn get_default(&self) -> &T[src]

pub fn clean(&mut self)[src]

Remove all entries from the grid that compare equal to the default

pub fn occuppied_entries(
    &self
) -> impl Iterator<Item = (&Location, &T)> + FusedIterator + Clone
[src]

Get an iterator over all of the occupied entries in the grid, in an arbitrary order.

pub fn occuppied_entries_mut(
    &mut self
) -> impl Iterator<Item = (&Location, &mut T)> + FusedIterator
[src]

Trait Implementations

impl<T: Clone + Clone + PartialEq> Clone for SparseGrid<T>[src]

default fn clone_from(&mut self, source: &Self)
1.0.0
[src]

Performs copy-assignment from source. Read more

impl<T: Debug + Clone + PartialEq> Debug for SparseGrid<T>[src]

impl<T: Clone + PartialEq> BaseGrid for SparseGrid<T>[src]

type Item = T

impl<T: Clone + PartialEq> GridBounds for SparseGrid<T>[src]

impl<T: Clone + PartialEq> BaseGridMut for SparseGrid<T>[src]

Auto Trait Implementations

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

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

Blanket Implementations

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

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

type Owned = T

impl<T> From for T[src]

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]