[][src]Trait gridly::prelude::GridBounds

pub trait GridBounds: BaseGridBounds {
    fn outer_root(&self) -> Location { ... }
fn num_rows(&self) -> Rows { ... }
fn num_columns(&self) -> Columns { ... }
fn dimension<C: VecComponent>(&self) -> C { ... }
fn root_row(&self) -> Row { ... }
fn root_column(&self) -> Column { ... }
fn root_component<C: LocComponent>(&self) -> C { ... }
fn range<C: LocComponent>(&self) -> ComponentRange<C> { ... }
fn row_range(&self) -> RowRange { ... }
fn column_range(&self) -> ColumnRange { ... }
fn check_component<C: LocComponent>(&self, c: C) -> Result<C, RangeError<C>> { ... }
fn check_row(&self, row: impl Into<Row>) -> Result<Row, RowRangeError> { ... }
fn check_column(
        &self,
        column: impl Into<Column>
    ) -> Result<Column, ColumnRangeError> { ... }
fn component_in_bounds<C: LocComponent>(&self, c: C) -> bool { ... }
fn row_in_bounds(&self, row: impl Into<Row>) -> bool { ... }
fn column_in_bounds(&self, column: impl Into<Column>) -> bool { ... }
fn check_location(
        &self,
        location: impl LocationLike
    ) -> Result<Location, BoundsError> { ... }
fn location_in_bounds(&self, location: impl LocationLike) -> bool { ... } }

Provided methods

fn outer_root(&self) -> Location

Get the outer root of the grid; that is, the location for which all valid locations in the grid have row < outer.row && column < outer.column

fn num_rows(&self) -> Rows

Get the height of the grid in Rows.

fn num_columns(&self) -> Columns

Get the width of the grid, in Columns.

fn dimension<C: VecComponent>(&self) -> C

Get the height or width of this grid.

fn root_row(&self) -> Row

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.

fn root_column(&self) -> Column

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.

fn root_component<C: LocComponent>(&self) -> C

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

Important traits for ComponentRange<C>
fn range<C: LocComponent>(&self) -> ComponentRange<C>

Get a Range over the row or column indexes

fn row_range(&self) -> RowRange

A range iterator over all the column indexes in this grid

fn column_range(&self) -> ColumnRange

A range iterator over all the row indexes in this grid

fn check_component<C: LocComponent>(&self, c: C) -> Result<C, RangeError<C>>

Check that a Row or a Column is inside the bounds described by this Grid.

fn check_row(&self, row: impl Into<Row>) -> Result<Row, RowRangeError>

fn check_column(
    &self,
    column: impl Into<Column>
) -> Result<Column, ColumnRangeError>

fn component_in_bounds<C: LocComponent>(&self, c: C) -> bool

fn row_in_bounds(&self, row: impl Into<Row>) -> bool

fn column_in_bounds(&self, column: impl Into<Column>) -> bool

fn check_location(
    &self,
    location: impl LocationLike
) -> Result<Location, BoundsError>

Check that a location is inside the bounds of this grid.

Returns the Location if successful, or an error describing the boundary error if not. This function is intended to help write more expressive code; ie, grid.check_location(loc).and_then(|loc| ...). Note that the safe grid interfaces are guarenteed to be bounds checked, where relevant.

fn location_in_bounds(&self, location: impl LocationLike) -> bool

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

Loading content...

Implementors

impl<G: BaseGridBounds> GridBounds for G[src]

Loading content...