[−][src]Struct vec2dim::Vec2d
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
Auto Trait Implementations
impl<T> Unpin for Vec2d<T> where
T: Unpin,
T: Unpin,
impl<T> Send for Vec2d<T> where
T: Send,
T: Send,
impl<T> Sync for Vec2d<T> where
T: Sync,
T: Sync,
impl<T> UnwindSafe for Vec2d<T> where
T: UnwindSafe,
T: UnwindSafe,
impl<T> RefUnwindSafe for Vec2d<T> where
T: RefUnwindSafe,
T: RefUnwindSafe,
Blanket Implementations
impl<T> From<T> for T
[src]
impl<T, U> Into<U> for T where
U: From<T>,
[src]
U: From<T>,
impl<T, U> TryFrom<U> for T where
U: Into<T>,
[src]
U: Into<T>,
type Error = Infallible
The type returned in the event of a conversion error.
fn try_from(value: U) -> Result<T, <T as TryFrom<U>>::Error>
[src]
impl<T, U> TryInto<U> for T where
U: TryFrom<T>,
[src]
U: TryFrom<T>,
type Error = <U as TryFrom<T>>::Error
The type returned in the event of a conversion error.
fn try_into(self) -> Result<U, <U as TryFrom<T>>::Error>
[src]
impl<T> BorrowMut<T> for T where
T: ?Sized,
[src]
T: ?Sized,
fn borrow_mut(&mut self) -> &mut T
[src]
impl<T> Borrow<T> for T where
T: ?Sized,
[src]
T: ?Sized,
impl<T> Any for T where
T: 'static + ?Sized,
[src]
T: 'static + ?Sized,