Struct all_is_cubes::math::FaceMap
source · 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) -> 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 repeat_copy(value: V) -> FaceMap<V>
pub const fn repeat_copy(value: V) -> FaceMap<V>
Constructs a FaceMap containing copies of the provided value.
This is practically identical to FaceMap::repeat() 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<'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§impl<V> PartialEq for FaceMap<V>where
V: PartialEq,
impl<V> PartialEq for FaceMap<V>where
V: PartialEq,
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: Copy,
impl<T> CloneToUninit for Twhere
T: Copy,
source§unsafe fn clone_to_uninit(&self, dst: *mut T)
unsafe fn clone_to_uninit(&self, dst: *mut T)
clone_to_uninit)source§impl<T> CloneToUninit for Twhere
T: Clone,
impl<T> CloneToUninit for Twhere
T: Clone,
source§default unsafe fn clone_to_uninit(&self, dst: *mut T)
default unsafe fn clone_to_uninit(&self, dst: *mut T)
clone_to_uninit)source§impl<T> Downcast for Twhere
T: Any,
impl<T> Downcast for Twhere
T: Any,
source§fn into_any(self: Box<T>) -> Box<dyn Any>
fn into_any(self: Box<T>) -> Box<dyn Any>
Box<dyn Trait> (where Trait: Downcast) to Box<dyn Any>. Box<dyn Any> can
then be further downcast into Box<ConcreteType> where ConcreteType implements Trait.source§fn into_any_rc(self: Rc<T>) -> Rc<dyn Any>
fn into_any_rc(self: Rc<T>) -> Rc<dyn Any>
Rc<Trait> (where Trait: Downcast) to Rc<Any>. Rc<Any> can then be
further downcast into Rc<ConcreteType> where ConcreteType implements Trait.source§fn as_any(&self) -> &(dyn Any + 'static)
fn as_any(&self) -> &(dyn Any + 'static)
&Trait (where Trait: Downcast) to &Any. This is needed since Rust cannot
generate &Any’s vtable from &Trait’s.source§fn as_any_mut(&mut self) -> &mut (dyn Any + 'static)
fn as_any_mut(&mut self) -> &mut (dyn Any + 'static)
&mut Trait (where Trait: Downcast) to &Any. This is needed since Rust cannot
generate &mut Any’s vtable from &mut Trait’s.source§impl<T> DowncastSync for T
impl<T> DowncastSync for T
source§impl<Q, K> Equivalent<K> for Q
impl<Q, K> Equivalent<K> for Q
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