pub struct Vec2D<V: Copy> { /* private fields */ }
Expand description
Holds the data for a Vec2D.
A Vec2D has a fixed size and cannot be resized.
Implementations
sourceimpl<V: Copy> Vec2D<V>
impl<V: Copy> Vec2D<V>
sourcepub fn new(size: Size<usize>, default: V) -> Self
pub fn new(size: Size<usize>, default: V) -> Self
Creates a new Vec2D of the size given.
It is filled with the default value.
sourcepub fn new_from_vecs(vec: Vec<Vec<V>>) -> Self
pub fn new_from_vecs(vec: Vec<Vec<V>>) -> Self
In Debug mode this will panic! if it is given a vector with different shaped arrays.
sourcepub fn rect(&self) -> Rect<usize>
pub fn rect(&self) -> Rect<usize>
Returns the size of this Vec2D as a Rect. This is for convenience, as the bottom left corner is always Point(0, 0).
pub fn width(&self) -> usize
pub fn height(&self) -> usize
sourcepub fn iter(&self) -> Vec2DIterator<'_, V>ⓘNotable traits for Vec2DIterator<'a, V>impl<'a, V: Copy> Iterator for Vec2DIterator<'a, V> type Item = (V, Point<usize>);
pub fn iter(&self) -> Vec2DIterator<'_, V>ⓘNotable traits for Vec2DIterator<'a, V>impl<'a, V: Copy> Iterator for Vec2DIterator<'a, V> type Item = (V, Point<usize>);
Returns a slice which encompasses the entire map.
sourcepub fn iter_of(&self, area: Rect<usize>) -> Vec2DIterator<'_, V>ⓘNotable traits for Vec2DIterator<'a, V>impl<'a, V: Copy> Iterator for Vec2DIterator<'a, V> type Item = (V, Point<usize>);
pub fn iter_of(&self, area: Rect<usize>) -> Vec2DIterator<'_, V>ⓘNotable traits for Vec2DIterator<'a, V>impl<'a, V: Copy> Iterator for Vec2DIterator<'a, V> type Item = (V, Point<usize>);
Allows you to iterate over a sub section of this map.
Trait Implementations
sourceimpl<'a, V: Copy> IntoIterator for &'a Vec2D<V>
impl<'a, V: Copy> IntoIterator for &'a Vec2D<V>
Auto Trait Implementations
impl<V> RefUnwindSafe for Vec2D<V> where
V: RefUnwindSafe,
impl<V> Send for Vec2D<V> where
V: Send,
impl<V> Sync for Vec2D<V> where
V: Sync,
impl<V> Unpin for Vec2D<V> where
V: Unpin,
impl<V> UnwindSafe for Vec2D<V> where
V: UnwindSafe,
Blanket Implementations
sourceimpl<T> BorrowMut<T> for T where
T: ?Sized,
impl<T> BorrowMut<T> for T where
T: ?Sized,
const: unstable · sourcefn borrow_mut(&mut self) -> &mut T
fn borrow_mut(&mut self) -> &mut T
Mutably borrows from an owned value. Read more
sourceimpl<T> ToOwned for T where
T: Clone,
impl<T> ToOwned for T where
T: Clone,
type Owned = T
type Owned = T
The resulting type after obtaining ownership.
sourcefn clone_into(&self, target: &mut T)
fn clone_into(&self, target: &mut T)
🔬 This is a nightly-only experimental API. (
toowned_clone_into
)Uses borrowed data to replace owned data, usually by cloning. Read more