Trait Grid3

Source
pub trait Grid3 {
    type Item;
    type XBound: RangeBounds<i32>;
    type YBound: RangeBounds<i32>;
    type ZBound: RangeBounds<i32>;

Show 15 methods // Required methods fn x_bound(&self) -> Self::XBound; fn y_bound(&self) -> Self::YBound; fn z_bound(&self) -> Self::ZBound; // Provided methods fn in_bounds<I>(&self, coord: I) -> bool where I: Into<Vector3<i32>> { ... } fn map<F, T>(self, func: F) -> Grid3Map<Self, F, T> where Self: Sized, F: Fn(Self::Item) -> T { ... } fn enumap<I, F, T>(self, func: F) -> Grid3EnuMap<Self, F, T, I> where Self: Sized, I: From<Vector3<i32>>, F: Fn(I, Self::Item) -> T { ... } fn flatten<I>(self, stride: I) -> Grid3Flat<Self> where Self: Sized, Self::Item: Grid3, Self::XBound: Clone + RangeBoundsTimes, Self::YBound: Clone + RangeBoundsTimes, Self::ZBound: Clone + RangeBoundsTimes, I: Into<Vector3<i32>> { ... } fn new_origin<I>(self, new_origin: I) -> Grid3NewOrigin<Self> where Self: Sized, Self::XBound: RangeBoundsPlus, Self::YBound: RangeBoundsPlus, Self::ZBound: RangeBoundsPlus, I: Into<Vector3<i32>> { ... } fn oob_handler<I, F>(self, handler: F) -> Grid3OobHandler<Self, I, F> where Self: Sized, I: From<Vector3<i32>>, F: Fn(I) -> Self::Item { ... } fn subview<X, Y, Z>( self, new_x: X, new_y: Y, new_z: Z, ) -> Grid3Slice<Self, X, Y, Z> where Self: Sized, Self::XBound: Debug, Self::YBound: Debug, Self::ZBound: Debug, X: RangeBounds<i32> + Clone + Debug, Y: RangeBounds<i32> + Clone + Debug, Z: RangeBounds<i32> + Clone + Debug { ... } fn try_subview<X, Y, Z>( self, new_x: X, new_y: Y, new_z: Z, ) -> Result<Grid3Slice<Self, X, Y, Z>, Self> where Self: Sized, Self::XBound: Debug, Self::YBound: Debug, X: RangeBounds<i32> + Clone + Debug, Y: RangeBounds<i32> + Clone + Debug, Z: RangeBounds<i32> + Clone + Debug { ... } fn subview_0to( self, new_x_len: i32, new_y_len: i32, new_z_len: i32, ) -> Grid3Slice<Self, Range0To, Range0To, Range0To> where Self: Sized, Self::XBound: Debug, Self::YBound: Debug, Self::ZBound: Debug { ... } fn try_subview_0to( self, new_x_len: i32, new_y_len: i32, new_z_len: i32, ) -> Result<Grid3Slice<Self, Range0To, Range0To, Range0To>, Self> where Self: Sized, Self::XBound: Debug, Self::YBound: Debug, Self::ZBound: Debug { ... } fn wrapping(self) -> Grid3Wrapping<Self> where Self: Sized, Self::XBound: BoundRange, Self::YBound: BoundRange, Self::ZBound: BoundRange { ... } fn collect(&self) -> ArrayGrid3<Self::Item> where Self: Grid3Get, Self::XBound: Into<Range0To>, Self::YBound: Into<Range0To>, Self::ZBound: Into<Range0To> { ... }
}
Expand description

Top-level trait for 2D grids.

Required Associated Types§

Required Methods§

Source

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

Source

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

Source

fn z_bound(&self) -> Self::ZBound

Provided Methods§

Source

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

Source

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

Element by-value mapping.

Source

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

Element by-value+coord mapping.

Source

fn flatten<I>(self, stride: I) -> Grid3Flat<Self>

Flattening a grid of grids with a regular stride.

Source

fn new_origin<I>(self, new_origin: I) -> Grid3NewOrigin<Self>

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

Source

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

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

This produces an unbounded grid.

Source

fn subview<X, Y, Z>( self, new_x: X, new_y: Y, new_z: Z, ) -> Grid3Slice<Self, X, Y, Z>
where Self: Sized, Self::XBound: Debug, Self::YBound: Debug, Self::ZBound: Debug, X: RangeBounds<i32> + Clone + Debug, Y: RangeBounds<i32> + Clone + Debug, Z: 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.

Source

fn try_subview<X, Y, Z>( self, new_x: X, new_y: Y, new_z: Z, ) -> Result<Grid3Slice<Self, X, Y, Z>, Self>
where Self: Sized, Self::XBound: Debug, Self::YBound: Debug, X: RangeBounds<i32> + Clone + Debug, Y: RangeBounds<i32> + Clone + Debug, Z: 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.

Source

fn subview_0to( self, new_x_len: i32, new_y_len: i32, new_z_len: i32, ) -> Grid3Slice<Self, Range0To, Range0To, Range0To>
where Self: Sized, Self::XBound: Debug, Self::YBound: Debug, Self::ZBound: 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.

Source

fn try_subview_0to( self, new_x_len: i32, new_y_len: i32, new_z_len: i32, ) -> Result<Grid3Slice<Self, Range0To, Range0To, Range0To>, Self>
where Self: Sized, Self::XBound: Debug, Self::YBound: Debug, Self::ZBound: 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.

Source

fn wrapping(self) -> Grid3Wrapping<Self>
where Self: Sized, Self::XBound: BoundRange, Self::YBound: BoundRange, Self::ZBound: 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.

Source

fn collect(&self) -> ArrayGrid3<Self::Item>
where Self: Grid3Get, Self::XBound: Into<Range0To>, Self::YBound: Into<Range0To>, Self::ZBound: Into<Range0To>,

Collect a grid’s elements into a heap allocation.

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

Dyn Compatibility§

This trait is not dyn compatible.

In older versions of Rust, dyn compatibility was called "object safety", so this trait is not object safe.

Implementors§

Source§

impl<'a, F, I, T> Grid3 for KolmoMutGrid3<'a, F, I, T>
where F: Fn(I) -> &'a mut T, T: 'a, I: From<Vector3<i32>>,

Source§

impl<'a, F, I, T> Grid3 for KolmoRefGrid3<'a, F, I, T>
where F: Fn(I) -> &'a T, T: 'a, I: From<Vector3<i32>>,

Source§

impl<F, I, T> Grid3 for KolmoGrid3<F, I, T>
where F: Fn(I) -> T, I: From<Vector3<i32>>,

Source§

impl<G> Grid3 for Grid3Flat<G>
where G: Grid3, <G as Grid3>::Item: Grid3, <G as Grid3>::XBound: Clone, <G as Grid3>::YBound: Clone, <G as Grid3>::ZBound: Clone,

Source§

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

Source§

type XBound = <G as Grid3>::XBound

Source§

type YBound = <G as Grid3>::YBound

Source§

type ZBound = <G as Grid3>::ZBound

Source§

impl<G> Grid3 for Grid3NewOrigin<G>

Source§

impl<G> Grid3 for Grid3Wrapping<G>
where G: Grid3, <G as Grid3>::XBound: BoundRange, <G as Grid3>::YBound: BoundRange, <G as Grid3>::ZBound: BoundRange,

Source§

impl<G, F, T> Grid3 for Grid3Map<G, F, T>
where G: Grid3, F: Fn(<G as Grid3>::Item) -> T,

Source§

type Item = T

Source§

type XBound = <G as Grid3>::XBound

Source§

type YBound = <G as Grid3>::YBound

Source§

type ZBound = <G as Grid3>::ZBound

Source§

impl<G, F, T, I> Grid3 for Grid3EnuMap<G, F, T, I>
where G: Grid3, I: From<Vector3<i32>>, F: Fn(I, <G as Grid3>::Item) -> T,

Source§

type Item = T

Source§

type XBound = <G as Grid3>::XBound

Source§

type YBound = <G as Grid3>::YBound

Source§

type ZBound = <G as Grid3>::ZBound

Source§

impl<G, I, F> Grid3 for Grid3OobHandler<G, I, F>
where G: Grid3, I: From<Vector3<i32>>, F: Fn(I) -> <G as Grid3>::Item,

Source§

impl<G, X, Y, Z> Grid3 for Grid3Slice<G, X, Y, Z>

Source§

type Item = <G as Grid3>::Item

Source§

type XBound = X

Source§

type YBound = Y

Source§

type ZBound = Z

Source§

impl<I, R, T, Fr, Fw> Grid3 for KolmoRwGrid3<I, R, T, Fr, Fw>
where Fr: Fn(I, &R) -> &T, Fw: FnMut(I, &mut R) -> &mut T, I: From<Vector3<i32>>,

Source§

impl<T> Grid3 for ArrayGrid3<T>

Source§

impl<T> Grid3 for Inline3x3x3Grid<T>

Source§

impl<T> Grid3 for T
where T: Deref, <T as Deref>::Target: Grid3,

Source§

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

Source§

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

Source§

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

Source§

type ZBound = <<T as Deref>::Target as Grid3>::ZBound