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> + Clone
pub fn values(&self) -> impl Iterator<Item = &V> + Clone
Iterate over the map values by reference, in the same order as Face6::ALL.
Sourcepub fn values_mut(&mut self) -> impl Iterator<Item = &mut V>
pub fn values_mut(&mut self) -> impl Iterator<Item = &mut V>
Iterate over the map values by mutable 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 sum(self) -> Vwhere
V: Add<Output = V>,
pub fn sum(self) -> Vwhere
V: Add<Output = V>,
Calculates the sum of all values.
This is semantically equivalent to .into_values_iter().sum() but computes the sum
using the ops::Add trait. It may be more efficient than involving iterators.
Sourcepub fn map_ref<'map, U>(
&'map self,
f: impl FnMut(Face6, &'map V) -> U,
) -> FaceMap<U>
pub fn map_ref<'map, U>( &'map self, f: impl FnMut(Face6, &'map V) -> U, ) -> FaceMap<U>
Transform values, taking the input by reference.
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) -> FaceMap<V>
pub fn with(self, face: Face6, value: V) -> FaceMap<V>
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) -> FaceMap<V>
pub fn rotate(self, rotation: GridRotation) -> FaceMap<V>
Shuffle the values in this map according to the given rotation.
Source§impl<V> FaceMap<V>where
V: Copy,
impl<V> FaceMap<V>where
V: Copy,
Sourcepub const fn splat_copy(value: V) -> FaceMap<V>
pub const fn splat_copy(value: V) -> FaceMap<V>
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> AddAssign for FaceMap<V>where
V: AddAssign,
impl<V> AddAssign for FaceMap<V>where
V: AddAssign,
Source§fn add_assign(&mut self, rhs: FaceMap<V>)
fn add_assign(&mut self, rhs: FaceMap<V>)
Apply the operator pairwise to the values for all six faces.
Source§impl<'arbitrary, V> Arbitrary<'arbitrary> for FaceMap<V>where
V: Arbitrary<'arbitrary>,
impl<'arbitrary, V> Arbitrary<'arbitrary> for FaceMap<V>where
V: Arbitrary<'arbitrary>,
Source§fn arbitrary(u: &mut Unstructured<'arbitrary>) -> Result<FaceMap<V>, Error>
fn arbitrary(u: &mut Unstructured<'arbitrary>) -> Result<FaceMap<V>, Error>
Self from the given unstructured data. Read moreSource§fn arbitrary_take_rest(u: Unstructured<'arbitrary>) -> Result<FaceMap<V>, Error>
fn arbitrary_take_rest(u: Unstructured<'arbitrary>) -> Result<FaceMap<V>, Error>
Self from the entirety of the given
unstructured data. Read moreSource§fn size_hint(depth: usize) -> (usize, Option<usize>)
fn size_hint(depth: usize) -> (usize, Option<usize>)
Unstructured this type
needs to construct itself. Read moreSource§fn try_size_hint(
depth: usize,
) -> Result<(usize, Option<usize>), MaxRecursionReached>
fn try_size_hint( depth: usize, ) -> Result<(usize, Option<usize>), MaxRecursionReached>
Unstructured this type
needs to construct itself. Read moreSource§impl<V> BitAndAssign for FaceMap<V>where
V: BitAndAssign,
impl<V> BitAndAssign for FaceMap<V>where
V: BitAndAssign,
Source§fn bitand_assign(&mut self, rhs: FaceMap<V>)
fn bitand_assign(&mut self, rhs: FaceMap<V>)
Apply the operator pairwise to the values for all six faces.
Source§impl<V> BitOrAssign for FaceMap<V>where
V: BitOrAssign,
impl<V> BitOrAssign for FaceMap<V>where
V: BitOrAssign,
Source§fn bitor_assign(&mut self, rhs: FaceMap<V>)
fn bitor_assign(&mut self, rhs: FaceMap<V>)
Apply the operator pairwise to the values for all six faces.
Source§impl<V> BitXorAssign for FaceMap<V>where
V: BitXorAssign,
impl<V> BitXorAssign for FaceMap<V>where
V: BitXorAssign,
Source§fn bitxor_assign(&mut self, rhs: FaceMap<V>)
fn bitxor_assign(&mut self, rhs: FaceMap<V>)
Apply the operator pairwise to the values for all six faces.
Source§impl<V> DivAssign for FaceMap<V>where
V: DivAssign,
impl<V> DivAssign for FaceMap<V>where
V: DivAssign,
Source§fn div_assign(&mut self, rhs: FaceMap<V>)
fn div_assign(&mut self, rhs: FaceMap<V>)
Apply the operator pairwise to the values for all six faces.
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 from_factory(factory: <FaceMap<V> as Exhaust>::Factory) -> FaceMap<V>
fn from_factory(factory: <FaceMap<V> as Exhaust>::Factory) -> FaceMap<V>
Self::Factory value produced by
its Self::Iter. Read moreSource§impl<V> IntoIterator for FaceMap<V>
impl<V> IntoIterator for FaceMap<V>
Source§impl<V> MulAssign for FaceMap<V>where
V: MulAssign,
impl<V> MulAssign for FaceMap<V>where
V: MulAssign,
Source§fn mul_assign(&mut self, rhs: FaceMap<V>)
fn mul_assign(&mut self, rhs: FaceMap<V>)
Apply the operator pairwise to the values for all six faces.
Source§impl<V> RemAssign for FaceMap<V>where
V: RemAssign,
impl<V> RemAssign for FaceMap<V>where
V: RemAssign,
Source§fn rem_assign(&mut self, rhs: FaceMap<V>)
fn rem_assign(&mut self, rhs: FaceMap<V>)
Apply the operator pairwise to the values for all six faces.
Source§impl<V> SubAssign for FaceMap<V>where
V: SubAssign,
impl<V> SubAssign for FaceMap<V>where
V: SubAssign,
Source§fn sub_assign(&mut self, rhs: FaceMap<V>)
fn sub_assign(&mut self, rhs: FaceMap<V>)
Apply the operator pairwise to the values for all six faces.
impl<V> Copy for FaceMap<V>where
V: Copy,
impl<V> Eq for FaceMap<V>where
V: Eq,
impl<V> StructuralPartialEq for FaceMap<V>
Auto Trait Implementations§
impl<V> Freeze for FaceMap<V>where
V: Freeze,
impl<V> RefUnwindSafe for FaceMap<V>where
V: RefUnwindSafe,
impl<V> Send for FaceMap<V>where
V: Send,
impl<V> Sync for FaceMap<V>where
V: Sync,
impl<V> Unpin for FaceMap<V>where
V: Unpin,
impl<V> UnwindSafe for FaceMap<V>where
V: UnwindSafe,
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
Source§impl<T> CheckedAs for T
impl<T> CheckedAs for T
Source§fn checked_as<Dst>(self) -> Option<Dst>where
T: CheckedCast<Dst>,
fn checked_as<Dst>(self) -> Option<Dst>where
T: CheckedCast<Dst>,
Source§impl<Src, Dst> CheckedCastFrom<Src> for Dstwhere
Src: CheckedCast<Dst>,
impl<Src, Dst> CheckedCastFrom<Src> for Dstwhere
Src: CheckedCast<Dst>,
Source§fn checked_cast_from(src: Src) -> Option<Dst>
fn checked_cast_from(src: Src) -> Option<Dst>
Source§impl<T> CloneToUninit for Twhere
T: Clone,
impl<T> CloneToUninit for Twhere
T: Clone,
Source§impl<Q, K> Equivalent<K> for Q
impl<Q, K> Equivalent<K> for Q
Source§fn equivalent(&self, key: &K) -> bool
fn equivalent(&self, key: &K) -> bool
key and return true if they are equal.Source§impl<Q, K> Equivalent<K> for Q
impl<Q, K> Equivalent<K> for Q
Source§impl<T> FromWorld for Twhere
T: Default,
impl<T> FromWorld for Twhere
T: Default,
Source§fn from_world(_world: &mut World) -> T
fn from_world(_world: &mut World) -> T
Creates Self using default().
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>
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>
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 more