[][src]Struct vec2dim::Vec2d

pub struct Vec2d<T> { /* fields omitted */ }

A two-dimensional array. Unlike a standard vector, Vec2d must maintain a constant number of elements equal to its number of rows times its number of columns.

Methods

impl<T: Default> Vec2d<T>[src]

pub fn new_with_default(rows: usize, cols: usize) -> Vec2d<T>[src]

Creates a new Vec2d<T> and initializes all the values to T::default().

pub fn add_row_of_default(&mut self)[src]

Adds a new row to the vector and sets all elements of that row to T::default().

impl<T: Copy> Vec2d<T>[src]

pub fn new_with_value(rows: usize, cols: usize, val: T) -> Vec2d<T>[src]

Creates a new Vec2d<T> and initializes all the values to a copy of val.

impl<T> Vec2d<T>[src]

pub fn new() -> Vec2d<T>[src]

Creates a new Vec2d<T> with no rows, columns, or elements.

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

Returns the number of elements in the array. Equal to the number of rows times the number of columns.

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

Returns the number of columns of the array.

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

Returns the number of rows of the array.

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

Returns the dimensions of the array as a tuple of (row, col).

Trait Implementations

impl<T> Index<usize> for Vec2d<T>[src]

type Output = [T]

The returned type after indexing.

impl<T> IndexMut<usize> for Vec2d<T>[src]

Auto Trait Implementations

impl<T> Unpin for Vec2d<T> where
    T: Unpin

impl<T> Sync for Vec2d<T> where
    T: Sync

impl<T> Send for Vec2d<T> where
    T: Send

impl<T> UnwindSafe for Vec2d<T> where
    T: UnwindSafe

impl<T> RefUnwindSafe for Vec2d<T> where
    T: RefUnwindSafe

Blanket Implementations

impl<T, U> Into<U> for T where
    U: From<T>, 
[src]

impl<T> From<T> for T[src]

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.

impl<T> Borrow<T> for T where
    T: ?Sized
[src]

impl<T> BorrowMut<T> for T where
    T: ?Sized
[src]

impl<T> Any for T where
    T: 'static + ?Sized
[src]