Skip to main content

wowlab_types/types/sim/
effect_ref.rs

1use super::SpellIdx;
2
3/// Coordinate of one 1-based effect within a spell.
4#[derive(Clone, Copy, Debug, Eq, Hash, PartialEq)]
5pub struct EffectRef {
6    pub spell: SpellIdx,
7    pub effect_index: u8,
8}
9
10impl EffectRef {
11    #[inline]
12    #[must_use]
13    pub const fn new(spell: SpellIdx, effect_index: u8) -> Self {
14        Self {
15            spell,
16            effect_index,
17        }
18    }
19}
20
21impl From<(SpellIdx, u8)> for EffectRef {
22    #[inline]
23    fn from((spell, effect_index): (SpellIdx, u8)) -> Self {
24        Self::new(spell, effect_index)
25    }
26}
27
28impl From<(u32, u8)> for EffectRef {
29    #[inline]
30    fn from((spell, effect_index): (u32, u8)) -> Self {
31        Self::new(SpellIdx::from_raw(spell), effect_index)
32    }
33}
34
35#[cfg(test)]
36#[path = "effect_ref/tests.rs"]
37mod tests;