[][src]Trait grid_trait::grid2::Grid2

pub trait Grid2 {
    type Item;
    type XBound: RangeBounds<i32>;
    type YBound: RangeBounds<i32>;
    fn x_bound(&self) -> Self::XBound;
fn y_bound(&self) -> Self::YBound; fn in_bounds<I>(&self, coord: I) -> bool
    where
        I: Into<Vector2<i32>>
, { ... }
fn map<F, T>(self, func: F) -> Grid2Map<Self, F, T>
    where
        Self: Sized,
        F: Fn(Self::Item) -> T
, { ... }
fn enumap<I, F, T>(self, func: F) -> Grid2EnuMap<Self, F, T, I>
    where
        Self: Sized,
        I: From<Vector2<i32>>,
        F: Fn(I, Self::Item) -> T
, { ... }
fn flatten<I>(self, stride: I) -> Grid2Flat<Self>
    where
        Self: Sized,
        Self::Item: Grid2,
        Self::XBound: Clone + RangeBoundsTimes,
        Self::YBound: Clone + RangeBoundsTimes,
        I: Into<Vector2<i32>>
, { ... }
fn new_origin<I>(self, new_origin: I) -> Grid2NewOrigin<Self>
    where
        Self: Sized,
        Self::XBound: RangeBoundsPlus,
        Self::YBound: RangeBoundsPlus,
        I: Into<Vector2<i32>>
, { ... }
fn oob_handler<I, F>(self, handler: F) -> Grid2OobHandler<Self, I, F>
    where
        Self: Sized,
        I: From<Vector2<i32>>,
        F: Fn(I) -> Self::Item
, { ... }
fn subview<X, Y>(self, new_x: X, new_y: Y) -> Grid2Slice<Self, X, Y>
    where
        Self: Sized,
        Self::XBound: Debug,
        Self::YBound: Debug,
        X: RangeBounds<i32> + Clone + Debug,
        Y: RangeBounds<i32> + Clone + Debug
, { ... }
fn try_subview<X, Y>(
        self,
        new_x: X,
        new_y: Y
    ) -> Result<Grid2Slice<Self, X, Y>, Self>
    where
        Self: Sized,
        Self::XBound: Debug,
        Self::YBound: Debug,
        X: RangeBounds<i32> + Clone + Debug,
        Y: RangeBounds<i32> + Clone + Debug
, { ... }
fn subview_0to(
        self,
        new_x_len: i32,
        new_y_len: i32
    ) -> Grid2Slice<Self, Range0To, Range0To>
    where
        Self: Sized,
        Self::XBound: Debug,
        Self::YBound: Debug
, { ... }
fn try_subview_0to(
        self,
        new_x_len: i32,
        new_y_len: i32
    ) -> Result<Grid2Slice<Self, Range0To, Range0To>, Self>
    where
        Self: Sized,
        Self::XBound: Debug,
        Self::YBound: Debug
, { ... }
fn wrapping(self) -> Grid2Wrapping<Self>
    where
        Self: Sized,
        Self::XBound: BoundRange,
        Self::YBound: BoundRange
, { ... }
fn collect(&self) -> ArrayGrid2<Self::Item>
    where
        Self: Grid2Get,
        Self::XBound: Into<Range0To>,
        Self::YBound: Into<Range0To>
, { ... } }

Top-level trait for 2D grids.

Associated Types

Loading content...

Required methods

fn x_bound(&self) -> Self::XBound

fn y_bound(&self) -> Self::YBound

Loading content...

Provided methods

fn in_bounds<I>(&self, coord: I) -> bool where
    I: Into<Vector2<i32>>, 

fn map<F, T>(self, func: F) -> Grid2Map<Self, F, T> where
    Self: Sized,
    F: Fn(Self::Item) -> T, 

Element by-value mapping.

fn enumap<I, F, T>(self, func: F) -> Grid2EnuMap<Self, F, T, I> where
    Self: Sized,
    I: From<Vector2<i32>>,
    F: Fn(I, Self::Item) -> T, 

Element by-value+coord mapping.

fn flatten<I>(self, stride: I) -> Grid2Flat<Self> where
    Self: Sized,
    Self::Item: Grid2,
    Self::XBound: Clone + RangeBoundsTimes,
    Self::YBound: Clone + RangeBoundsTimes,
    I: Into<Vector2<i32>>, 

Flattening a grid of grids with a regular stride.

fn new_origin<I>(self, new_origin: I) -> Grid2NewOrigin<Self> where
    Self: Sized,
    Self::XBound: RangeBoundsPlus,
    Self::YBound: RangeBoundsPlus,
    I: Into<Vector2<i32>>, 

<0, 0> in this grid becomes new_origin in resultant grid.

fn oob_handler<I, F>(self, handler: F) -> Grid2OobHandler<Self, I, F> where
    Self: Sized,
    I: From<Vector2<i32>>,
    F: Fn(I) -> Self::Item

Provide function to provide elments at out-of-bounds coordinates.

This produces an unbounded grid.

fn subview<X, Y>(self, new_x: X, new_y: Y) -> Grid2Slice<Self, X, Y> where
    Self: Sized,
    Self::XBound: Debug,
    Self::YBound: Debug,
    X: RangeBounds<i32> + Clone + Debug,
    Y: RangeBounds<i32> + Clone + Debug

View a sub-rectangle of this grid.

If the new bounds are not a subset of the current bounds, this will panic.

fn try_subview<X, Y>(
    self,
    new_x: X,
    new_y: Y
) -> Result<Grid2Slice<Self, X, Y>, Self> where
    Self: Sized,
    Self::XBound: Debug,
    Self::YBound: Debug,
    X: RangeBounds<i32> + Clone + Debug,
    Y: RangeBounds<i32> + Clone + Debug

View a sub-rectangle of this grid.

If the new bounds are not a subset of the current bounds, this will fail.

fn subview_0to(
    self,
    new_x_len: i32,
    new_y_len: i32
) -> Grid2Slice<Self, Range0To, Range0To> where
    Self: Sized,
    Self::XBound: Debug,
    Self::YBound: Debug

View a sub-rectangle of this grid, beginning at origin.

If the new bounds are not a subset of the current bounds, this will panic.

fn try_subview_0to(
    self,
    new_x_len: i32,
    new_y_len: i32
) -> Result<Grid2Slice<Self, Range0To, Range0To>, Self> where
    Self: Sized,
    Self::XBound: Debug,
    Self::YBound: Debug

View a sub-rectangle of this grid, beginning at origin.

If the new bounds are not a subset of the current bounds, this will fail.

fn wrapping(self) -> Grid2Wrapping<Self> where
    Self: Sized,
    Self::XBound: BoundRange,
    Self::YBound: BoundRange

View of this grid which wraps around the edges.

The input grid must be bounded in all directions, and the output grid is completely unbounded.

fn collect(&self) -> ArrayGrid2<Self::Item> where
    Self: Grid2Get,
    Self::XBound: Into<Range0To>,
    Self::YBound: Into<Range0To>, 

Collect a grid's elements into a heap allocation.

The grid must be bound from 0 to a finite limit.

Loading content...

Implementors

impl<'a, F, I, T> Grid2 for KolmoMutGrid2<'a, F, I, T> where
    F: Fn(I) -> &'a mut T,
    T: 'a,
    I: From<Vector2<i32>>, 
[src]

type Item = T

type XBound = RangeFull

type YBound = RangeFull

impl<'a, F, I, T> Grid2 for KolmoRefGrid2<'a, F, I, T> where
    F: Fn(I) -> &'a T,
    T: 'a,
    I: From<Vector2<i32>>, 
[src]

type Item = T

type XBound = RangeFull

type YBound = RangeFull

impl<F, I, T> Grid2 for KolmoGrid2<F, I, T> where
    F: Fn(I) -> T,
    I: From<Vector2<i32>>, 
[src]

type Item = T

type XBound = RangeFull

type YBound = RangeFull

impl<G> Grid2 for Grid2Flat<G> where
    G: Grid2,
    <G as Grid2>::Item: Grid2,
    <G as Grid2>::XBound: Clone,
    <G as Grid2>::YBound: Clone
[src]

type Item = <<G as Grid2>::Item as Grid2>::Item

type XBound = <G as Grid2>::XBound

type YBound = <G as Grid2>::YBound

impl<G> Grid2 for Grid2NewOrigin<G> where
    G: Grid2,
    <G as Grid2>::XBound: RangeBoundsPlus,
    <G as Grid2>::YBound: RangeBoundsPlus
[src]

type Item = <G as Grid2>::Item

type XBound = <<G as Grid2>::XBound as RangeBoundsPlus>::Output

type YBound = <<G as Grid2>::YBound as RangeBoundsPlus>::Output

impl<G> Grid2 for Grid2Wrapping<G> where
    G: Grid2,
    <G as Grid2>::XBound: BoundRange,
    <G as Grid2>::YBound: BoundRange
[src]

type Item = <G as Grid2>::Item

type XBound = RangeFull

type YBound = RangeFull

impl<G, F, T> Grid2 for Grid2Map<G, F, T> where
    G: Grid2,
    F: Fn(<G as Grid2>::Item) -> T, 
[src]

type Item = T

type XBound = <G as Grid2>::XBound

type YBound = <G as Grid2>::YBound

impl<G, F, T, I> Grid2 for Grid2EnuMap<G, F, T, I> where
    G: Grid2,
    I: From<Vector2<i32>>,
    F: Fn(I, <G as Grid2>::Item) -> T, 
[src]

type Item = T

type XBound = <G as Grid2>::XBound

type YBound = <G as Grid2>::YBound

impl<G, I, F> Grid2 for Grid2OobHandler<G, I, F> where
    G: Grid2,
    I: From<Vector2<i32>>,
    F: Fn(I) -> <G as Grid2>::Item
[src]

type Item = <G as Grid2>::Item

type XBound = RangeFull

type YBound = RangeFull

impl<G, X, Y> Grid2 for Grid2Slice<G, X, Y> where
    G: Grid2,
    X: RangeBounds<i32> + Clone,
    Y: RangeBounds<i32> + Clone
[src]

type Item = <G as Grid2>::Item

type XBound = X

type YBound = Y

impl<I, R, T, Fr, Fw> Grid2 for KolmoRwGrid2<I, R, T, Fr, Fw> where
    Fr: Fn(I, &R) -> &T,
    Fw: FnMut(I, &mut R) -> &mut T,
    I: From<Vector2<i32>>, 
[src]

type Item = T

type XBound = RangeFull

type YBound = RangeFull

impl<T> Grid2 for ArrayGrid2<T>[src]

type Item = T

type XBound = Range0To

type YBound = Range0To

impl<T> Grid2 for Inline3x3Grid<T>[src]

type Item = T

type XBound = Range0To

type YBound = Range0To

impl<T> Grid2 for T where
    T: Deref,
    <T as Deref>::Target: Grid2
[src]

type Item = <<T as Deref>::Target as Grid2>::Item

type XBound = <<T as Deref>::Target as Grid2>::XBound

type YBound = <<T as Deref>::Target as Grid2>::YBound

Loading content...