Skip to main content

TableNd

Struct TableNd 

Source
pub struct TableNd<T, const N: usize> { /* private fields */ }
Expand description

A dense N-dimensional table.

Implementations§

Source§

impl<T: Default + Clone, const N: usize> TableNd<T, N>

Source

pub fn new(size: [usize; N]) -> Self

Creates a new dense table initialized with default values.

Source§

impl<T: Clone, const N: usize> TableNd<T, N>

Source

pub fn init(value: T, size: [usize; N]) -> Self

Creates a new dense table initialized with the given value.

Source

pub fn fill(&mut self, value: T)

Fills the table with the given value.

Source§

impl<T, const N: usize> TableNd<T, N>

Source

pub fn size(&self) -> &[usize; N]

Returns the multi-dimensional size of this table.

Source§

impl<T, const N: usize> TableNd<Option<T>, N>

Source

pub fn capacity(&self) -> usize

Returns the capacity of this table, i.e. the total number of memory slots available.

This is the product of the size().

Source

pub fn len(&self) -> usize

Returns the number of values set to Some(_).

Source

pub fn is_empty(&self) -> bool

Checks if all the values are set to None.

Trait Implementations§

Source§

impl<T, const N: usize> Index<[usize; N]> for TableNd<T, N>

Source§

type Output = T

The returned type after indexing.
Source§

fn index(&self, index: [usize; N]) -> &Self::Output

Performs the indexing (container[index]) operation. Read more
Source§

impl<T, const N: usize> IndexMut<[usize; N]> for TableNd<T, N>

Source§

fn index_mut(&mut self, index: [usize; N]) -> &mut Self::Output

Performs the mutable indexing (container[index]) operation. Read more

Auto Trait Implementations§

§

impl<T, const N: usize> Freeze for TableNd<T, N>

§

impl<T, const N: usize> RefUnwindSafe for TableNd<T, N>
where T: RefUnwindSafe,

§

impl<T, const N: usize> Send for TableNd<T, N>
where T: Send,

§

impl<T, const N: usize> Sync for TableNd<T, N>
where T: Sync,

§

impl<T, const N: usize> Unpin for TableNd<T, N>

§

impl<T, const N: usize> UnsafeUnpin for TableNd<T, N>

§

impl<T, const N: usize> UnwindSafe for TableNd<T, N>
where T: UnwindSafe,

Blanket Implementations§

Source§

impl<T> Any for T
where T: 'static + ?Sized,

Source§

fn type_id(&self) -> TypeId

Gets the TypeId of self. Read more
Source§

impl<T> Borrow<T> for T
where T: ?Sized,

Source§

fn borrow(&self) -> &T

Immutably borrows from an owned value. Read more
Source§

impl<T> BorrowMut<T> for T
where T: ?Sized,

Source§

fn borrow_mut(&mut self) -> &mut T

Mutably borrows from an owned value. Read more
Source§

impl<T> From<T> for T

Source§

fn from(t: T) -> T

Returns the argument unchanged.

Source§

impl<T, U> Into<U> for T
where U: From<T>,

Source§

fn into(self) -> U

Calls U::from(self).

That is, this conversion is whatever the implementation of From<T> for U chooses to do.

Source§

impl<T, U> TryFrom<U> for T
where U: Into<T>,

Source§

type Error = Infallible

The type returned in the event of a conversion error.
Source§

fn try_from(value: U) -> Result<T, <T as TryFrom<U>>::Error>

Performs the conversion.
Source§

impl<T, U> TryInto<U> for T
where U: TryFrom<T>,

Source§

type Error = <U as TryFrom<T>>::Error

The type returned in the event of a conversion error.
Source§

fn try_into(self) -> Result<U, <U as TryFrom<T>>::Error>

Performs the conversion.