Struct surge_traits::imports::EffectTypeArray
source · [−]pub struct EffectTypeArray<T> { /* private fields */ }
Expand description
Container to associate each enum variant with a datum.
This is an array type and it implements much of the array API, with a few caveats and exceptions. The foremost deviation from the standard array API is that this container must be indexed using variants of the correct enum type.
Implementations
sourceimpl<T> EffectTypeArray<T>
impl<T> EffectTypeArray<T>
sourcepub fn new(initial_value: T) -> EffectTypeArray<T> where
T: Clone,
pub fn new(initial_value: T) -> EffectTypeArray<T> where
T: Clone,
Create a new array filled with the given value.
sourcepub fn new_with<F>(initial_value: F) -> EffectTypeArray<T> where
F: Fn(EffectType) -> T,
pub fn new_with<F>(initial_value: F) -> EffectTypeArray<T> where
F: Fn(EffectType) -> T,
Create a new array using a closure to associate each enum variant with its initial value.
pub const fn len(&self) -> usize
pub const fn is_empty(&self) -> bool
pub fn iter(&'a self) -> impl Iterator<Item = &'a T>
pub fn iter_mut(&'a mut self) -> impl Iterator<Item = &'a mut T>
sourcepub fn iter_enumerate(&'a self) -> impl Iterator<Item = (EffectType, &'a T)>
pub fn iter_enumerate(&'a self) -> impl Iterator<Item = (EffectType, &'a T)>
Iterate and Enumerate, where Enumerate yields enum variants instead of usize.
sourcepub fn iter_mut_enumerate(
&'a mut self
) -> impl Iterator<Item = (EffectType, &'a mut T)>
pub fn iter_mut_enumerate(
&'a mut self
) -> impl Iterator<Item = (EffectType, &'a mut T)>
Iterate and Enumerate, where Enumerate yields enum variants instead of usize.
sourcepub fn map<F, Q>(&self, f: F) -> EffectTypeArray<Q> where
F: Fn(&T) -> Q,
pub fn map<F, Q>(&self, f: F) -> EffectTypeArray<Q> where
F: Fn(&T) -> Q,
Returns an array like self, with function f applied to each element.
Trait Implementations
sourceimpl<T> Clone for EffectTypeArray<T> where
T: Clone,
impl<T> Clone for EffectTypeArray<T> where
T: Clone,
sourcefn clone(&self) -> EffectTypeArray<T>
fn clone(&self) -> EffectTypeArray<T>
Returns a copy of the value. Read more
1.0.0 · sourcefn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
Performs copy-assignment from source
. Read more
sourceimpl<T> Debug for EffectTypeArray<T> where
T: Debug,
impl<T> Debug for EffectTypeArray<T> where
T: Debug,
sourceimpl<T> Default for EffectTypeArray<T> where
T: Default,
impl<T> Default for EffectTypeArray<T> where
T: Default,
sourcefn default() -> EffectTypeArray<T>
fn default() -> EffectTypeArray<T>
Returns the “default value” for a type. Read more
sourceimpl<T> Hash for EffectTypeArray<T> where
T: Hash,
impl<T> Hash for EffectTypeArray<T> where
T: Hash,
sourceimpl<T> Index<EffectType> for EffectTypeArray<T>
impl<T> Index<EffectType> for EffectTypeArray<T>
type Output = T
type Output = T
The returned type after indexing.
sourcefn index(
&self,
x: EffectType
) -> &<EffectTypeArray<T> as Index<EffectType>>::Output
fn index(
&self,
x: EffectType
) -> &<EffectTypeArray<T> as Index<EffectType>>::Output
Performs the indexing (container[index]
) operation. Read more
sourceimpl<T> IndexMut<EffectType> for EffectTypeArray<T>
impl<T> IndexMut<EffectType> for EffectTypeArray<T>
sourcefn index_mut(
&mut self,
x: EffectType
) -> &mut <EffectTypeArray<T> as Index<EffectType>>::Output
fn index_mut(
&mut self,
x: EffectType
) -> &mut <EffectTypeArray<T> as Index<EffectType>>::Output
Performs the mutable indexing (container[index]
) operation. Read more
sourceimpl<'a, T> IntoIterator for &'a mut EffectTypeArray<T>
impl<'a, T> IntoIterator for &'a mut EffectTypeArray<T>
sourceimpl<'a, T> IntoIterator for &'a EffectTypeArray<T>
impl<'a, T> IntoIterator for &'a EffectTypeArray<T>
sourceimpl<T> Ord for EffectTypeArray<T> where
T: Ord,
impl<T> Ord for EffectTypeArray<T> where
T: Ord,
sourceimpl<T> PartialEq<EffectTypeArray<T>> for EffectTypeArray<T> where
T: PartialEq<T>,
impl<T> PartialEq<EffectTypeArray<T>> for EffectTypeArray<T> where
T: PartialEq<T>,
sourceimpl<T> PartialOrd<EffectTypeArray<T>> for EffectTypeArray<T> where
T: PartialOrd<T>,
impl<T> PartialOrd<EffectTypeArray<T>> for EffectTypeArray<T> where
T: PartialOrd<T>,
sourcefn partial_cmp(&self, other: &EffectTypeArray<T>) -> Option<Ordering>
fn partial_cmp(&self, other: &EffectTypeArray<T>) -> Option<Ordering>
This method returns an ordering between self
and other
values if one exists. Read more
1.0.0 · sourcefn lt(&self, other: &Rhs) -> bool
fn lt(&self, other: &Rhs) -> bool
This method tests less than (for self
and other
) and is used by the <
operator. Read more
1.0.0 · sourcefn le(&self, other: &Rhs) -> bool
fn le(&self, other: &Rhs) -> bool
This method tests less than or equal to (for self
and other
) and is used by the <=
operator. Read more
impl<T> Copy for EffectTypeArray<T> where
T: Copy,
impl<T> Eq for EffectTypeArray<T> where
T: Eq,
Auto Trait Implementations
impl<T> RefUnwindSafe for EffectTypeArray<T> where
T: RefUnwindSafe,
impl<T> Send for EffectTypeArray<T> where
T: Send,
impl<T> Sync for EffectTypeArray<T> where
T: Sync,
impl<T> Unpin for EffectTypeArray<T> where
T: Unpin,
impl<T> UnwindSafe for EffectTypeArray<T> where
T: UnwindSafe,
Blanket Implementations
sourceimpl<T> BorrowMut<T> for T where
T: ?Sized,
impl<T> BorrowMut<T> for T where
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<T> ToOwned for T where
T: Clone,
impl<T> ToOwned for T where
T: Clone,
type Owned = T
type Owned = T
The resulting type after obtaining ownership.
sourcefn clone_into(&self, target: &mut T)
fn clone_into(&self, target: &mut T)
toowned_clone_into
)Uses borrowed data to replace owned data, usually by cloning. Read more