[−][src]Struct gridly::grid::SingleView
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]
&self,
cross: T::Converse
) -> Result<&'a G::Item, RangeError<T::Converse>>
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]
Notable traits for LocationRange<C>
impl<C: Component> Iterator for LocationRange<C> type Item = Location;
Get the specific locations associated with this view.
pub fn iter(
&self
) -> impl Iterator<Item = &'a G::Item> + DoubleEndedIterator + FusedIterator + ExactSizeIterator + Debug + Clone
[src]
&self
) -> impl Iterator<Item = &'a G::Item> + DoubleEndedIterator + FusedIterator + ExactSizeIterator + Debug + Clone
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]
&self
) -> impl Iterator<Item = (Location, &'a G::Item)> + DoubleEndedIterator + FusedIterator + ExactSizeIterator + Debug + Clone
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]
&self
) -> impl Iterator<Item = (T::Converse, &'a G::Item)> + DoubleEndedIterator + FusedIterator + ExactSizeIterator + Debug + Clone
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]
&self,
column: impl Into<Column>
) -> Result<&'a G::Item, ColumnRangeError>
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]
fn clone(&self) -> Self
[src]
fn clone_from(&mut self, source: &Self)
1.0.0[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]
Auto Trait Implementations
impl<'a, G: ?Sized, T> RefUnwindSafe for SingleView<'a, G, T> where
G: RefUnwindSafe,
T: RefUnwindSafe,
G: RefUnwindSafe,
T: RefUnwindSafe,
impl<'a, G: ?Sized, T> Send for SingleView<'a, G, T> where
G: Sync,
T: Send,
G: Sync,
T: Send,
impl<'a, G: ?Sized, T> Sync for SingleView<'a, G, T> where
G: Sync,
T: Sync,
G: Sync,
T: Sync,
impl<'a, G: ?Sized, T> Unpin for SingleView<'a, G, T> where
T: Unpin,
T: Unpin,
impl<'a, G: ?Sized, T> UnwindSafe for SingleView<'a, G, T> where
G: RefUnwindSafe,
T: UnwindSafe,
G: RefUnwindSafe,
T: UnwindSafe,
Blanket Implementations
impl<T> Any for T where
T: 'static + ?Sized,
[src]
T: 'static + ?Sized,
impl<T> Borrow<T> for T where
T: ?Sized,
[src]
T: ?Sized,
impl<T> BorrowMut<T> for T where
T: ?Sized,
[src]
T: ?Sized,
pub fn borrow_mut(&mut self) -> &mut T
[src]
impl<T> From<T> for T
[src]
impl<T, U> Into<U> for T where
U: From<T>,
[src]
U: From<T>,
impl<T> ToOwned for T where
T: Clone,
[src]
T: Clone,
type Owned = T
The resulting type after obtaining ownership.
pub fn to_owned(&self) -> T
[src]
pub fn clone_into(&self, target: &mut T)
[src]
impl<T, U> TryFrom<U> for T where
U: Into<T>,
[src]
U: Into<T>,
type Error = Infallible
The type returned in the event of a conversion error.
pub fn try_from(value: U) -> Result<T, <T as TryFrom<U>>::Error>
[src]
impl<T, U> TryInto<U> for T where
U: TryFrom<T>,
[src]
U: TryFrom<T>,