pub struct FaceMap<V> {
pub nx: V,
pub ny: V,
pub nz: V,
pub px: V,
pub py: V,
pub pz: V,
}Expand description
Container for values keyed by Face6s. Always holds exactly six elements.
Fields§
§nx: VThe value whose key is Face6::NX.
ny: VThe value whose key is Face6::NY.
nz: VThe value whose key is Face6::NZ.
px: VThe value whose key is Face6::PX.
py: VThe value whose key is Face6::PY.
pz: VThe value whose key is Face6::PZ.
Implementations§
Source§impl<V> FaceMap<V>
impl<V> FaceMap<V>
Sourcepub fn negatives<U>(self) -> Vector3D<V, U>where
V: Copy,
pub fn negatives<U>(self) -> Vector3D<V, U>where
V: Copy,
Returns a vector containing the values for each negative face.
Sourcepub fn positives<U>(self) -> Vector3D<V, U>where
V: Copy,
pub fn positives<U>(self) -> Vector3D<V, U>where
V: Copy,
Returns a vector containing the values for each positive face.
Sourcepub fn iter(&self) -> impl Iterator<Item = (Face6, &V)>
pub fn iter(&self) -> impl Iterator<Item = (Face6, &V)>
Iterate over the map’s key-value pairs by reference, in the same order as Face6::ALL.
Sourcepub fn iter_mut(&mut self) -> impl Iterator<Item = (Face6, &mut V)>
pub fn iter_mut(&mut self) -> impl Iterator<Item = (Face6, &mut V)>
Iterate over the map’s key-value pairs by mutable reference, in the same order as Face6::ALL.
Sourcepub fn values(&self) -> impl Iterator<Item = &V>
pub fn values(&self) -> impl Iterator<Item = &V>
Iterate over the map values by reference, in the same order as Face6::ALL.
Sourcepub fn into_values(self) -> [V; 6]
pub fn into_values(self) -> [V; 6]
Convert to an array, whose elements are arranged in the same order as Face6::ALL.
Sourcepub fn into_values_iter(self) -> impl Iterator<Item = V>
pub fn into_values_iter(self) -> impl Iterator<Item = V>
Convert to an iterator, whose items are arranged in the same order as Face6::ALL.
Sourcepub fn zip<U, R>(
self,
other: FaceMap<U>,
f: impl FnMut(Face6, V, U) -> R,
) -> FaceMap<R>
pub fn zip<U, R>( self, other: FaceMap<U>, f: impl FnMut(Face6, V, U) -> R, ) -> FaceMap<R>
Combine two FaceMaps using a function applied to each pair of corresponding values.
Sourcepub fn with(self, face: Face6, value: V) -> Self
pub fn with(self, face: Face6, value: V) -> Self
Returns this map with one entry’s value replaced.
This may be used for constructing a map with only one interesting entry:
use all_is_cubes::math::{Face6, FaceMap};
assert_eq!(
FaceMap::default().with(Face6::PY, 10),
{
let mut m = FaceMap::default();
m[Face6::PY] = 10;
m
},
);Sourcepub fn rotate(self, rotation: GridRotation) -> Self
pub fn rotate(self, rotation: GridRotation) -> Self
Shuffle the values in this map according to the given rotation.
Source§impl<V: Copy> FaceMap<V>
impl<V: Copy> FaceMap<V>
Sourcepub const fn splat_copy(value: V) -> Self
pub const fn splat_copy(value: V) -> Self
Constructs a FaceMap containing copies of the provided value.
This is practically identical to FaceMap::splat() except that it is a
const fn. It may be removed from future major versions once Rust supports const
trait function calls.
Trait Implementations§
Source§impl<V> Exhaust for FaceMap<V>where
V: Exhaust,
impl<V> Exhaust for FaceMap<V>where
V: Exhaust,
Source§type Iter = ExhaustFaceMapIter<V>
type Iter = ExhaustFaceMapIter<V>
Self::exhaust_factories().
See the trait documentation for what properties this iterator should have. Read moreSource§fn exhaust_factories() -> Self::Iter
fn exhaust_factories() -> Self::Iter
Source§fn from_factory(factory: Self::Factory) -> Self
fn from_factory(factory: Self::Factory) -> Self
Self::Factory value produced by
its Self::Iter. Read more