Struct mutils::Vec2D[][src]

pub struct Vec2D<V: Copy> { /* fields omitted */ }

Holds the data for a Vec2D.

A Vec2D has a fixed size and cannot be resized.

Implementations

impl<V: Copy> Vec2D<V>[src]

pub fn new(size: Size<usize>, default: V) -> Self[src]

Creates a new Vec2D of the size given.

It is filled with the default value.

pub fn get(&self, pos: Point<usize>) -> Option<&V>[src]

Returns the tile at the position given.

pub fn set(&mut self, pos: Point<usize>, value: V)[src]

Sets a tile at the position given.

pub fn rect(&self) -> Rect<usize>[src]

pub fn size(&self) -> Size<usize>[src]

Returns the size of this Vec2D.

pub fn width(&self) -> usize[src]

pub fn height(&self) -> usize[src]

pub fn iter(&self) -> Vec2DIterator<'_, V>[src]

Returns a slice which encompasses the entire map.

pub fn iter_of(&self, area: Rect<usize>) -> Vec2DIterator<'_, V>[src]

Allows you to iterate over a sub section of this map.

Trait Implementations

impl<V: Clone + Copy> Clone for Vec2D<V>[src]

impl<V: Debug + Copy> Debug for Vec2D<V>[src]

impl<V: Copy> Index<Point<usize>> for Vec2D<V>[src]

type Output = V

The returned type after indexing.

impl<V: Copy> IndexMut<Point<usize>> for Vec2D<V>[src]

impl<'a, V: Copy> IntoIterator for &'a Vec2D<V>[src]

type Item = (V, Point<usize>)

The type of the elements being iterated over.

type IntoIter = Vec2DIterator<'a, V>

Which kind of iterator are we turning this into?

impl<V: Copy + PartialEq> PartialEq<Vec2D<V>> for Vec2D<V>[src]

Auto Trait Implementations

impl<V> RefUnwindSafe for Vec2D<V> where
    V: RefUnwindSafe
[src]

impl<V> Send for Vec2D<V> where
    V: Send
[src]

impl<V> Sync for Vec2D<V> where
    V: Sync
[src]

impl<V> Unpin for Vec2D<V> where
    V: Unpin
[src]

impl<V> UnwindSafe for Vec2D<V> where
    V: UnwindSafe
[src]

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.