Struct skeletal_model::bone::BoneMap
source · [−]Expand description
Provides a map of BoneKind -> T. Every possible BoneKind must have a
corresponding value.
This is more efficient than a HashMap, because it is done without allocation
inline, and the BoneKinds don’t need to be hashed.
Example
let mut m = BoneMap::default();
for b in BoneKind::iter() {
m[b] = format!("this is a {b:?}");
}
assert_eq!(m[BoneKind::Chest], format!("this is a {:?}", BoneKind::Chest))Tuple Fields
0: [T; 16]Implementations
sourceimpl<T> BoneMap<T>
impl<T> BoneMap<T>
pub fn new(map: [T; 16]) -> Self
sourcepub fn iter(&self) -> Iter<'_, T>
pub fn iter(&self) -> Iter<'_, T>
Gets an iterator over the (key, value) pairs of the BoneMap.
Iteration is guaranteed to start at BoneKind::root() but beyond that,
iteration order is not guaranteed. However, iteration is exhaustive over
the various kinds of bones.
sourcepub fn iter_mut(&mut self) -> IterMut<'_, T>
pub fn iter_mut(&mut self) -> IterMut<'_, T>
Gets a mutable iterator over the (key, value) pairs of the BoneMap.
See also: Self::iter()
Trait Implementations
sourceimpl<'a, T> IntoIterator for &'a BoneMap<T>
impl<'a, T> IntoIterator for &'a BoneMap<T>
sourceimpl<'a, T> IntoIterator for &'a mut BoneMap<T>
impl<'a, T> IntoIterator for &'a mut BoneMap<T>
sourceimpl<T> IntoIterator for BoneMap<T>
impl<T> IntoIterator for BoneMap<T>
sourceimpl<T: PartialEq> PartialEq<BoneMap<T>> for BoneMap<T>
impl<T: PartialEq> PartialEq<BoneMap<T>> for BoneMap<T>
sourceimpl<T> TryFromIterator<(BoneKind, T)> for BoneMap<T>
impl<T> TryFromIterator<(BoneKind, T)> for BoneMap<T>
type Error = IncompleteArrayError
type Error = IncompleteArrayError
The type returned in the event of a conversion error.
sourcefn try_from_iter<I>(iter: I) -> Result<Self, Self::Error>where
I: IntoIterator<Item = (BoneKind, T)>,
fn try_from_iter<I>(iter: I) -> Result<Self, Self::Error>where
I: IntoIterator<Item = (BoneKind, T)>,
Attempts to perform the conversion.
impl<T: Copy> Copy for BoneMap<T>
impl<T: Eq> Eq for BoneMap<T>
impl<T> StructuralEq for BoneMap<T>
impl<T> StructuralPartialEq for BoneMap<T>
Auto Trait Implementations
impl<T> RefUnwindSafe for BoneMap<T>where
T: RefUnwindSafe,
impl<T> Send for BoneMap<T>where
T: Send,
impl<T> Sync for BoneMap<T>where
T: Sync,
impl<T> Unpin for BoneMap<T>where
T: Unpin,
impl<T> UnwindSafe for BoneMap<T>where
T: UnwindSafe,
Blanket Implementations
sourceimpl<T> BorrowMut<T> for Twhere
T: ?Sized,
impl<T> BorrowMut<T> for Twhere
T: ?Sized,
const: unstable · sourcefn borrow_mut(&mut self) -> &mut T
fn borrow_mut(&mut self) -> &mut T
Mutably borrows from an owned value. Read more
sourceimpl<Q, K> Equivalent<K> for Qwhere
Q: Eq + ?Sized,
K: Borrow<Q> + ?Sized,
impl<Q, K> Equivalent<K> for Qwhere
Q: Eq + ?Sized,
K: Borrow<Q> + ?Sized,
sourcefn equivalent(&self, key: &K) -> bool
fn equivalent(&self, key: &K) -> bool
Compare self to
key and return true if they are equal.impl<SS, SP> SupersetOf<SS> for SPwhere
SS: SubsetOf<SP>,
impl<SS, SP> SupersetOf<SS> for SPwhere
SS: SubsetOf<SP>,
fn to_subset(&self) -> Option<SS>
fn to_subset(&self) -> Option<SS>
The inverse inclusion map: attempts to construct
self from the equivalent element of its
superset. Read morefn is_in_subset(&self) -> bool
fn is_in_subset(&self) -> bool
Checks if
self is actually part of its subset T (and can be converted to it).fn to_subset_unchecked(&self) -> SS
fn to_subset_unchecked(&self) -> SS
Use with care! Same as
self.to_subset but without any property checks. Always succeeds.fn from_subset(element: &SS) -> SP
fn from_subset(element: &SS) -> SP
The inclusion map: converts
self to the equivalent element of its superset.