[][src]Trait gridly::grid::GridBoundsExt

pub trait GridBoundsExt: GridBounds {
    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) -> IndexRange<C> { ... }
fn row_range(&self) -> RowRange { ... }
fn column_range(&self) -> ColumnRange { ... }
fn check_component<C: LocComponent>(&self, c: C) -> Result<C, RangeError<C>> { ... }
fn component_in_bounds<C: LocComponent>(&self, c: C) -> bool { ... }
fn check_location(
        &self,
        loc: impl Into<Location>
    ) -> Result<Location, LocationRangeError> { ... }
fn location_in_bounds(&self, location: impl Into<Location>) -> bool { ... } }

Provided methods

fn num_rows(&self) -> Rows

Get the height of the grid in Rows. This value MUST be const for any given grid.

fn num_columns(&self) -> Columns

Get the width of the grid, in Columns. This value MUST be const for any given grid.

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. This value MUST be const for any given grid.

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. This value MUST be const for any given grid.

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

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

Important traits for Range<C>
fn range<C: LocComponent>(&self) -> IndexRange<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 component_in_bounds<C: LocComponent>(&self, c: C) -> bool

fn check_location(
    &self,
    loc: impl Into<Location>
) -> Result<Location, LocationRangeError>

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 Into<Location>) -> bool

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

Loading content...

Implementors

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

fn num_rows(&self) -> Rows[src]

fn num_columns(&self) -> Columns[src]

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

fn root_row(&self) -> Row[src]

fn root_column(&self) -> Column[src]

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

Important traits for Range<C>
fn range<C: LocComponent>(&self) -> IndexRange<C>[src]

fn row_range(&self) -> RowRange[src]

fn column_range(&self) -> ColumnRange[src]

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

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

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

fn location_in_bounds(&self, location: impl Into<Location>) -> bool[src]

Loading content...