[−][src]Struct gridly::grid::View
A view of the rows or columns in a grid.
This struct provides a row- or column-major view of a grid. For instance,
a View<MyGrid, Row>
is a view of all of the rows in MyGrid
. The view
can be indexed over its type (for instance, a View<G, Row>
can be
indexed by Row
). It can also be iterated, where each iteration step
produces a SingleView
, which is a view of a single row or column (that
single view can itself be iterated to get all the cells).
Implementations
impl<'a, G: Grid + ?Sized, T: LocComponent> View<'a, G, T>
[src]
pub fn len(&self) -> T::Distance
[src]
Get the length of this view; that is, the number of Rows or Columns
pub unsafe fn get_unchecked(&self, index: T) -> SingleView<'a, G, T>
[src]
Get a view of a single row or column of the grid, without bounds checking the index.
Safety
Callers must ensure that the index has been bounds-checked before calling this method.
pub fn get(&self, index: T) -> Result<SingleView<'a, G, T>, RangeError<T>>
[src]
Get a view of a single row or column of the grid. Returns a range error if the index is out of range.
pub fn range(&self) -> ComponentRange<T>ⓘNotable traits for ComponentRange<C>
impl<C: Component> Iterator for ComponentRange<C> type Item = C;
[src]
Notable traits for ComponentRange<C>
impl<C: Component> Iterator for ComponentRange<C> type Item = C;
Get a range over all the row or column indexes of this view.
pub fn iter(
&self
) -> impl Iterator<Item = SingleView<'a, G, T>> + DoubleEndedIterator + FusedIterator + ExactSizeIterator + Debug + Clone
[src]
&self
) -> impl Iterator<Item = SingleView<'a, G, T>> + DoubleEndedIterator + FusedIterator + ExactSizeIterator + Debug + Clone
Create an iterator over the rows or columns of the grid. Each iterated
element is a SingleView
, which is a view over a single row or column
of the grid.
impl<'a, G: Grid + ?Sized> View<'a, G, Row>
[src]
impl<'a, G: Grid + ?Sized> View<'a, G, Column>
[src]
pub fn column(
&self,
column: impl Into<Column>
) -> Result<ColumnView<'a, G>, ColumnRangeError>
[src]
&self,
column: impl Into<Column>
) -> Result<ColumnView<'a, G>, ColumnRangeError>
Trait Implementations
impl<'a, G: Grid + ?Sized, T: LocComponent> Clone for View<'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 View<'a, G, T>
[src]
Auto Trait Implementations
impl<'a, G: ?Sized, T> RefUnwindSafe for View<'a, G, T> where
G: RefUnwindSafe,
T: RefUnwindSafe,
G: RefUnwindSafe,
T: RefUnwindSafe,
impl<'a, G: ?Sized, T> Send for View<'a, G, T> where
G: Sync,
T: Send,
G: Sync,
T: Send,
impl<'a, G: ?Sized, T> Sync for View<'a, G, T> where
G: Sync,
T: Sync,
G: Sync,
T: Sync,
impl<'a, G: ?Sized, T> Unpin for View<'a, G, T> where
T: Unpin,
T: Unpin,
impl<'a, G: ?Sized, T> UnwindSafe for View<'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>,