[][src]Struct gridly::grid::SingleView

pub struct SingleView<'a, G: Grid + ?Sized, T: LocComponent> { /* fields omitted */ }

View of a single Row or Column of a grid.

A SingleView provides a view over a single row or column of a grid, based on its generic parameter. For instance, a SingleView<'a, G, Row> is a view over a single row of a grid.

A SingleView can be indexed; for instance, a RowView can be indexed with a Column to a get a specific cell.

Implementations

impl<'a, G: Grid + ?Sized, T: LocComponent> SingleView<'a, G, T>[src]

pub fn len(&self) -> <T::Converse as LocComponent>::Distance[src]

Get the length of this view. For example, for a SingleView<'a, G, Row>, get the number of columns.

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

Get the index of the Row or Column that this view represents. This index is safely guaranteed to have been bounds checked when the SingleView was constructed.

pub unsafe fn get_unchecked(&self, cross: T::Converse) -> &'a G::Item[src]

Get a particular cell in the row or column by an index, without bounds checking the index.

Safety

Callers must ensure that the index has been bounds-checked before calling this method.

pub fn get(
    &self,
    cross: T::Converse
) -> Result<&'a G::Item, RangeError<T::Converse>>
[src]

Get a particular cell in the row or column, or return an error if the index is out of bounds.

pub fn range(&self) -> LocationRange<T>

Notable traits for LocationRange<C>

impl<C: Component> Iterator for LocationRange<C> type Item = Location;
[src]

Get the specific locations associated with this view.

pub fn iter(
    &self
) -> impl Iterator<Item = &'a G::Item> + DoubleEndedIterator + FusedIterator + ExactSizeIterator + Debug + Clone
[src]

Get an iterator over the cells in this row or column

pub fn iter_with_locations(
    &self
) -> impl Iterator<Item = (Location, &'a G::Item)> + DoubleEndedIterator + FusedIterator + ExactSizeIterator + Debug + Clone
[src]

Get an iterator over (Location, &Item) pairs for this row or column.

pub fn iter_with_indices(
    &self
) -> impl Iterator<Item = (T::Converse, &'a G::Item)> + DoubleEndedIterator + FusedIterator + ExactSizeIterator + Debug + Clone
[src]

Get an iterator over (Index, &Item) pairs for this column. For instance, for a RowView, this iterates over (Column, &Item) pairs.

impl<'a, G: Grid + ?Sized> SingleView<'a, G, Row>[src]

pub fn column(
    &self,
    column: impl Into<Column>
) -> Result<&'a G::Item, ColumnRangeError>
[src]

Get a reference to the cell in a specific column of this view's row.

impl<'a, G: Grid + ?Sized> SingleView<'a, G, Column>[src]

pub fn row(&self, row: impl Into<Row>) -> Result<&'a G::Item, RowRangeError>[src]

Get a reference to the cell in a specific row of this view's column.

Trait Implementations

impl<'a, G: Grid + ?Sized, T: LocComponent> Clone for SingleView<'a, G, T>[src]

impl<'a, G: Debug + Grid + ?Sized, T: Debug + LocComponent> Debug for SingleView<'a, G, T>[src]

impl<'a, G: Grid + ?Sized, T: LocComponent> Index<<T as Component>::Converse> for SingleView<'a, G, T>[src]

type Output = G::Item

The returned type after indexing.

Auto Trait Implementations

impl<'a, G: ?Sized, T> RefUnwindSafe for SingleView<'a, G, T> where
    G: RefUnwindSafe,
    T: RefUnwindSafe

impl<'a, G: ?Sized, T> Send for SingleView<'a, G, T> where
    G: Sync,
    T: Send

impl<'a, G: ?Sized, T> Sync for SingleView<'a, G, T> where
    G: Sync,
    T: Sync

impl<'a, G: ?Sized, T> Unpin for SingleView<'a, G, T> where
    T: Unpin

impl<'a, G: ?Sized, T> UnwindSafe for SingleView<'a, G, T> where
    G: RefUnwindSafe,
    T: UnwindSafe

Blanket Implementations

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

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

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

impl<T> From<T> for T[src]

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

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

type Owned = T

The resulting type after obtaining ownership.

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

type Error = Infallible

The type returned in the event of a conversion error.

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

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

The type returned in the event of a conversion error.