pub struct HeterogeneousPalette<V: Hash + Eq + Copy, const DIM: usize> {
cube: Box<[[[V; DIM]; DIM]; DIM]>,
palette: Vec<(V, u16)>,
}Expand description
A heterogeneous palette container.
Every value in the cube appears exactly once in the palette. The fields are private so only this module can change the cube and palette together.
Fields§
§cube: Box<[[[V; DIM]; DIM]; DIM]>§palette: Vec<(V, u16)>Implementations§
Source§impl<V: Hash + Eq + Copy, const DIM: usize> HeterogeneousPalette<V, DIM>
impl<V: Hash + Eq + Copy, const DIM: usize> HeterogeneousPalette<V, DIM>
Sourcepub(crate) fn palette(&self) -> &[(V, u16)]
pub(crate) fn palette(&self) -> &[(V, u16)]
The distinct values in the cube, each with the number of cells holding it.
fn get(&self, x: usize, y: usize, z: usize) -> V
fn get_at_index(&self, index: usize) -> V
Sourcepub fn iter_values(&self) -> impl Iterator<Item = &V>
pub fn iter_values(&self) -> impl Iterator<Item = &V>
Returns an iterator over all values in the cube in y, z, x order.
fn set(&mut self, x: usize, y: usize, z: usize, value: V) -> V
Trait Implementations§
Auto Trait Implementations§
impl<V, const DIM: usize> Freeze for HeterogeneousPalette<V, DIM>
impl<V, const DIM: usize> RefUnwindSafe for HeterogeneousPalette<V, DIM>
impl<V, const DIM: usize> Send for HeterogeneousPalette<V, DIM>
impl<V, const DIM: usize> Sync for HeterogeneousPalette<V, DIM>
impl<V, const DIM: usize> Unpin for HeterogeneousPalette<V, DIM>
impl<V, const DIM: usize> UnsafeUnpin for HeterogeneousPalette<V, DIM>
impl<V, const DIM: usize> UnwindSafe for HeterogeneousPalette<V, DIM>
Blanket Implementations§
Source§impl<T> BorrowMut<T> for Twhere
T: ?Sized,
impl<T> BorrowMut<T> for Twhere
T: ?Sized,
Source§fn borrow_mut(&mut self) -> &mut T
fn borrow_mut(&mut self) -> &mut T
Mutably borrows from an owned value. Read more
Source§impl<T> CloneToUninit for Twhere
T: Clone,
impl<T> CloneToUninit for Twhere
T: Clone,
§impl<T> Instrument for T
impl<T> Instrument for T
§fn instrument(self, span: Span) -> Instrumented<Self> ⓘ
fn instrument(self, span: Span) -> Instrumented<Self> ⓘ
Source§impl<T> IntoEither for T
impl<T> IntoEither for T
Source§fn into_either(self, into_left: bool) -> Either<Self, Self> ⓘ
fn into_either(self, into_left: bool) -> Either<Self, Self> ⓘ
Converts
self into a Left variant of Either<Self, Self>
if into_left is true.
Converts self into a Right variant of Either<Self, Self>
otherwise. Read moreSource§fn into_either_with<F>(self, into_left: F) -> Either<Self, Self> ⓘ
fn into_either_with<F>(self, into_left: F) -> Either<Self, Self> ⓘ
Converts
self into a Left variant of Either<Self, Self>
if into_left(&self) returns true.
Converts self into a Right variant of Either<Self, Self>
otherwise. Read moreWraps this value in an
Arc<SyncMutex<>>