wow_world_base/inner/wrath/
spell_cast_target_flags.rs

1/// Auto generated from the original `wowm` in file [`wow_message_parser/wowm/world/common.wowm:70`](https://github.com/gtker/wow_messages/tree/main/wow_message_parser/wowm/world/common.wowm#L70):
2/// ```text
3/// flag SpellCastTargetFlags : u32 {
4///     SELF = 0x00000000;
5///     UNUSED1 = 0x00000001;
6///     UNIT = 0x00000002;
7///     UNIT_RAID = 0x00000004;
8///     UNIT_PARTY = 0x00000008;
9///     ITEM = 0x00000010;
10///     SOURCE_LOCATION = 0x00000020;
11///     DEST_LOCATION = 0x00000040;
12///     UNIT_ENEMY = 0x00000080;
13///     UNIT_ALLY = 0x00000100;
14///     CORPSE_ENEMY = 0x00000200;
15///     UNIT_DEAD = 0x00000400;
16///     GAMEOBJECT = 0x00000800;
17///     TRADE_ITEM = 0x00001000;
18///     STRING = 0x00002000;
19///     LOCKED = 0x00004000;
20///     CORPSE_ALLY = 0x00008000;
21///     UNIT_MINIPET = 0x00010000;
22///     GLYPH_SLOT = 0x00020000;
23///     DEST_TARGET = 0x00040000;
24///     UNUSED20 = 0x00080000;
25///     UNIT_PASSENGER = 0x00100000;
26/// }
27/// ```
28#[derive(Debug, PartialEq, Eq, Hash, Ord, PartialOrd, Copy, Clone, Default)]
29#[cfg_attr(feature = "serde", derive(serde::Deserialize, serde::Serialize))]
30#[cfg_attr(feature = "serde", serde(transparent))]
31pub struct SpellCastTargetFlags {
32    inner: u32,
33}
34
35#[cfg(feature = "print-testcase")]
36impl SpellCastTargetFlags {
37    #[allow(clippy::missing_const_for_fn)]
38    pub fn as_test_case_value(&self) -> String {
39        let mut s = String::new();
40        let mut first = true;
41        if self.is_empty() {
42            use std::fmt::Write;
43            if !first {
44                write!(s, " | ").unwrap();
45            }
46            write!(s, "SELF").unwrap();
47            first = false;
48        }
49        if self.is_unused1() {
50            use std::fmt::Write;
51            if !first {
52                write!(s, " | ").unwrap();
53            }
54            write!(s, "UNUSED1").unwrap();
55            first = false;
56        }
57        if self.is_unit() {
58            use std::fmt::Write;
59            if !first {
60                write!(s, " | ").unwrap();
61            }
62            write!(s, "UNIT").unwrap();
63            first = false;
64        }
65        if self.is_unit_raid() {
66            use std::fmt::Write;
67            if !first {
68                write!(s, " | ").unwrap();
69            }
70            write!(s, "UNIT_RAID").unwrap();
71            first = false;
72        }
73        if self.is_unit_party() {
74            use std::fmt::Write;
75            if !first {
76                write!(s, " | ").unwrap();
77            }
78            write!(s, "UNIT_PARTY").unwrap();
79            first = false;
80        }
81        if self.is_item() {
82            use std::fmt::Write;
83            if !first {
84                write!(s, " | ").unwrap();
85            }
86            write!(s, "ITEM").unwrap();
87            first = false;
88        }
89        if self.is_source_location() {
90            use std::fmt::Write;
91            if !first {
92                write!(s, " | ").unwrap();
93            }
94            write!(s, "SOURCE_LOCATION").unwrap();
95            first = false;
96        }
97        if self.is_dest_location() {
98            use std::fmt::Write;
99            if !first {
100                write!(s, " | ").unwrap();
101            }
102            write!(s, "DEST_LOCATION").unwrap();
103            first = false;
104        }
105        if self.is_unit_enemy() {
106            use std::fmt::Write;
107            if !first {
108                write!(s, " | ").unwrap();
109            }
110            write!(s, "UNIT_ENEMY").unwrap();
111            first = false;
112        }
113        if self.is_unit_ally() {
114            use std::fmt::Write;
115            if !first {
116                write!(s, " | ").unwrap();
117            }
118            write!(s, "UNIT_ALLY").unwrap();
119            first = false;
120        }
121        if self.is_corpse_enemy() {
122            use std::fmt::Write;
123            if !first {
124                write!(s, " | ").unwrap();
125            }
126            write!(s, "CORPSE_ENEMY").unwrap();
127            first = false;
128        }
129        if self.is_unit_dead() {
130            use std::fmt::Write;
131            if !first {
132                write!(s, " | ").unwrap();
133            }
134            write!(s, "UNIT_DEAD").unwrap();
135            first = false;
136        }
137        if self.is_gameobject() {
138            use std::fmt::Write;
139            if !first {
140                write!(s, " | ").unwrap();
141            }
142            write!(s, "GAMEOBJECT").unwrap();
143            first = false;
144        }
145        if self.is_trade_item() {
146            use std::fmt::Write;
147            if !first {
148                write!(s, " | ").unwrap();
149            }
150            write!(s, "TRADE_ITEM").unwrap();
151            first = false;
152        }
153        if self.is_string() {
154            use std::fmt::Write;
155            if !first {
156                write!(s, " | ").unwrap();
157            }
158            write!(s, "STRING").unwrap();
159            first = false;
160        }
161        if self.is_locked() {
162            use std::fmt::Write;
163            if !first {
164                write!(s, " | ").unwrap();
165            }
166            write!(s, "LOCKED").unwrap();
167            first = false;
168        }
169        if self.is_corpse_ally() {
170            use std::fmt::Write;
171            if !first {
172                write!(s, " | ").unwrap();
173            }
174            write!(s, "CORPSE_ALLY").unwrap();
175            first = false;
176        }
177        if self.is_unit_minipet() {
178            use std::fmt::Write;
179            if !first {
180                write!(s, " | ").unwrap();
181            }
182            write!(s, "UNIT_MINIPET").unwrap();
183            first = false;
184        }
185        if self.is_glyph_slot() {
186            use std::fmt::Write;
187            if !first {
188                write!(s, " | ").unwrap();
189            }
190            write!(s, "GLYPH_SLOT").unwrap();
191            first = false;
192        }
193        if self.is_dest_target() {
194            use std::fmt::Write;
195            if !first {
196                write!(s, " | ").unwrap();
197            }
198            write!(s, "DEST_TARGET").unwrap();
199            first = false;
200        }
201        if self.is_unused20() {
202            use std::fmt::Write;
203            if !first {
204                write!(s, " | ").unwrap();
205            }
206            write!(s, "UNUSED20").unwrap();
207            first = false;
208        }
209        if self.is_unit_passenger() {
210            use std::fmt::Write;
211            if !first {
212                write!(s, " | ").unwrap();
213            }
214            write!(s, "UNIT_PASSENGER").unwrap();
215            first = false;
216        }
217        s
218    }
219
220}
221
222impl SpellCastTargetFlags {
223    pub const fn new(inner: u32) -> Self {
224        Self { inner }
225    }
226
227    pub const SELF: u32 = 0x00;
228    pub const UNUSED1: u32 = 0x01;
229    pub const UNIT: u32 = 0x02;
230    pub const UNIT_RAID: u32 = 0x04;
231    pub const UNIT_PARTY: u32 = 0x08;
232    pub const ITEM: u32 = 0x10;
233    pub const SOURCE_LOCATION: u32 = 0x20;
234    pub const DEST_LOCATION: u32 = 0x40;
235    pub const UNIT_ENEMY: u32 = 0x80;
236    pub const UNIT_ALLY: u32 = 0x100;
237    pub const CORPSE_ENEMY: u32 = 0x200;
238    pub const UNIT_DEAD: u32 = 0x400;
239    pub const GAMEOBJECT: u32 = 0x800;
240    pub const TRADE_ITEM: u32 = 0x1000;
241    pub const STRING: u32 = 0x2000;
242    pub const LOCKED: u32 = 0x4000;
243    pub const CORPSE_ALLY: u32 = 0x8000;
244    pub const UNIT_MINIPET: u32 = 0x10000;
245    pub const GLYPH_SLOT: u32 = 0x20000;
246    pub const DEST_TARGET: u32 = 0x40000;
247    pub const UNUSED20: u32 = 0x80000;
248    pub const UNIT_PASSENGER: u32 = 0x100000;
249
250    pub const fn empty() -> Self {
251        Self { inner: 0 }
252    }
253
254    pub const fn is_empty(&self) -> bool {
255        self.inner == 0
256    }
257
258    pub const fn all() -> Self {
259        Self {
260            inner: Self::SELF
261                | Self::UNUSED1
262                | Self::UNIT
263                | Self::UNIT_RAID
264                | Self::UNIT_PARTY
265                | Self::ITEM
266                | Self::SOURCE_LOCATION
267                | Self::DEST_LOCATION
268                | Self::UNIT_ENEMY
269                | Self::UNIT_ALLY
270                | Self::CORPSE_ENEMY
271                | Self::UNIT_DEAD
272                | Self::GAMEOBJECT
273                | Self::TRADE_ITEM
274                | Self::STRING
275                | Self::LOCKED
276                | Self::CORPSE_ALLY
277                | Self::UNIT_MINIPET
278                | Self::GLYPH_SLOT
279                | Self::DEST_TARGET
280                | Self::UNUSED20
281                | Self::UNIT_PASSENGER
282        }
283    }
284
285    pub const fn is_unused1(&self) -> bool {
286        (self.inner & Self::UNUSED1) != 0
287    }
288
289    /// not used in any spells as of 2.4.3 (can be set dynamically)
290    pub const fn new_unused1() -> Self {
291        Self { inner: Self::UNUSED1 }
292    }
293
294    pub fn set_unused1(&mut self) -> Self {
295        self.inner |= Self::UNUSED1;
296        *self
297    }
298
299    pub fn clear_unused1(&mut self) -> Self {
300        self.inner &= Self::UNUSED1.reverse_bits();
301        *self
302    }
303
304    pub const fn is_unit(&self) -> bool {
305        (self.inner & Self::UNIT) != 0
306    }
307
308    /// pguid
309    pub const fn new_unit() -> Self {
310        Self { inner: Self::UNIT }
311    }
312
313    pub fn set_unit(&mut self) -> Self {
314        self.inner |= Self::UNIT;
315        *self
316    }
317
318    pub fn clear_unit(&mut self) -> Self {
319        self.inner &= Self::UNIT.reverse_bits();
320        *self
321    }
322
323    pub const fn is_unit_raid(&self) -> bool {
324        (self.inner & Self::UNIT_RAID) != 0
325    }
326
327    /// not used in any spells as of 2.4.3 (can be set dynamically) - raid member
328    pub const fn new_unit_raid() -> Self {
329        Self { inner: Self::UNIT_RAID }
330    }
331
332    pub fn set_unit_raid(&mut self) -> Self {
333        self.inner |= Self::UNIT_RAID;
334        *self
335    }
336
337    pub fn clear_unit_raid(&mut self) -> Self {
338        self.inner &= Self::UNIT_RAID.reverse_bits();
339        *self
340    }
341
342    pub const fn is_unit_party(&self) -> bool {
343        (self.inner & Self::UNIT_PARTY) != 0
344    }
345
346    /// not used in any spells as of 2.4.3 (can be set dynamically) - party member
347    pub const fn new_unit_party() -> Self {
348        Self { inner: Self::UNIT_PARTY }
349    }
350
351    pub fn set_unit_party(&mut self) -> Self {
352        self.inner |= Self::UNIT_PARTY;
353        *self
354    }
355
356    pub fn clear_unit_party(&mut self) -> Self {
357        self.inner &= Self::UNIT_PARTY.reverse_bits();
358        *self
359    }
360
361    pub const fn is_item(&self) -> bool {
362        (self.inner & Self::ITEM) != 0
363    }
364
365    /// pguid
366    pub const fn new_item() -> Self {
367        Self { inner: Self::ITEM }
368    }
369
370    pub fn set_item(&mut self) -> Self {
371        self.inner |= Self::ITEM;
372        *self
373    }
374
375    pub fn clear_item(&mut self) -> Self {
376        self.inner &= Self::ITEM.reverse_bits();
377        *self
378    }
379
380    pub const fn is_source_location(&self) -> bool {
381        (self.inner & Self::SOURCE_LOCATION) != 0
382    }
383
384    /// 3xfloat
385    pub const fn new_source_location() -> Self {
386        Self { inner: Self::SOURCE_LOCATION }
387    }
388
389    pub fn set_source_location(&mut self) -> Self {
390        self.inner |= Self::SOURCE_LOCATION;
391        *self
392    }
393
394    pub fn clear_source_location(&mut self) -> Self {
395        self.inner &= Self::SOURCE_LOCATION.reverse_bits();
396        *self
397    }
398
399    pub const fn is_dest_location(&self) -> bool {
400        (self.inner & Self::DEST_LOCATION) != 0
401    }
402
403    /// 3xfloat
404    pub const fn new_dest_location() -> Self {
405        Self { inner: Self::DEST_LOCATION }
406    }
407
408    pub fn set_dest_location(&mut self) -> Self {
409        self.inner |= Self::DEST_LOCATION;
410        *self
411    }
412
413    pub fn clear_dest_location(&mut self) -> Self {
414        self.inner &= Self::DEST_LOCATION.reverse_bits();
415        *self
416    }
417
418    pub const fn is_unit_enemy(&self) -> bool {
419        (self.inner & Self::UNIT_ENEMY) != 0
420    }
421
422    /// `CanAttack` == true
423    pub const fn new_unit_enemy() -> Self {
424        Self { inner: Self::UNIT_ENEMY }
425    }
426
427    pub fn set_unit_enemy(&mut self) -> Self {
428        self.inner |= Self::UNIT_ENEMY;
429        *self
430    }
431
432    pub fn clear_unit_enemy(&mut self) -> Self {
433        self.inner &= Self::UNIT_ENEMY.reverse_bits();
434        *self
435    }
436
437    pub const fn is_unit_ally(&self) -> bool {
438        (self.inner & Self::UNIT_ALLY) != 0
439    }
440
441    /// `CanAssist` == true
442    pub const fn new_unit_ally() -> Self {
443        Self { inner: Self::UNIT_ALLY }
444    }
445
446    pub fn set_unit_ally(&mut self) -> Self {
447        self.inner |= Self::UNIT_ALLY;
448        *self
449    }
450
451    pub fn clear_unit_ally(&mut self) -> Self {
452        self.inner &= Self::UNIT_ALLY.reverse_bits();
453        *self
454    }
455
456    pub const fn is_corpse_enemy(&self) -> bool {
457        (self.inner & Self::CORPSE_ENEMY) != 0
458    }
459
460    /// pguid, `CanAssist` == false
461    pub const fn new_corpse_enemy() -> Self {
462        Self { inner: Self::CORPSE_ENEMY }
463    }
464
465    pub fn set_corpse_enemy(&mut self) -> Self {
466        self.inner |= Self::CORPSE_ENEMY;
467        *self
468    }
469
470    pub fn clear_corpse_enemy(&mut self) -> Self {
471        self.inner &= Self::CORPSE_ENEMY.reverse_bits();
472        *self
473    }
474
475    pub const fn is_unit_dead(&self) -> bool {
476        (self.inner & Self::UNIT_DEAD) != 0
477    }
478
479    /// skinning-like effects
480    pub const fn new_unit_dead() -> Self {
481        Self { inner: Self::UNIT_DEAD }
482    }
483
484    pub fn set_unit_dead(&mut self) -> Self {
485        self.inner |= Self::UNIT_DEAD;
486        *self
487    }
488
489    pub fn clear_unit_dead(&mut self) -> Self {
490        self.inner &= Self::UNIT_DEAD.reverse_bits();
491        *self
492    }
493
494    pub const fn is_gameobject(&self) -> bool {
495        (self.inner & Self::GAMEOBJECT) != 0
496    }
497
498    /// pguid, 0 spells in 2.4.3
499    pub const fn new_gameobject() -> Self {
500        Self { inner: Self::GAMEOBJECT }
501    }
502
503    pub fn set_gameobject(&mut self) -> Self {
504        self.inner |= Self::GAMEOBJECT;
505        *self
506    }
507
508    pub fn clear_gameobject(&mut self) -> Self {
509        self.inner &= Self::GAMEOBJECT.reverse_bits();
510        *self
511    }
512
513    pub const fn is_trade_item(&self) -> bool {
514        (self.inner & Self::TRADE_ITEM) != 0
515    }
516
517    /// pguid, 0 spells
518    pub const fn new_trade_item() -> Self {
519        Self { inner: Self::TRADE_ITEM }
520    }
521
522    pub fn set_trade_item(&mut self) -> Self {
523        self.inner |= Self::TRADE_ITEM;
524        *self
525    }
526
527    pub fn clear_trade_item(&mut self) -> Self {
528        self.inner &= Self::TRADE_ITEM.reverse_bits();
529        *self
530    }
531
532    pub const fn is_string(&self) -> bool {
533        (self.inner & Self::STRING) != 0
534    }
535
536    /// string, 0 spells
537    pub const fn new_string() -> Self {
538        Self { inner: Self::STRING }
539    }
540
541    pub fn set_string(&mut self) -> Self {
542        self.inner |= Self::STRING;
543        *self
544    }
545
546    pub fn clear_string(&mut self) -> Self {
547        self.inner &= Self::STRING.reverse_bits();
548        *self
549    }
550
551    pub const fn is_locked(&self) -> bool {
552        (self.inner & Self::LOCKED) != 0
553    }
554
555    /// 199 spells, opening object/lock
556    pub const fn new_locked() -> Self {
557        Self { inner: Self::LOCKED }
558    }
559
560    pub fn set_locked(&mut self) -> Self {
561        self.inner |= Self::LOCKED;
562        *self
563    }
564
565    pub fn clear_locked(&mut self) -> Self {
566        self.inner &= Self::LOCKED.reverse_bits();
567        *self
568    }
569
570    pub const fn is_corpse_ally(&self) -> bool {
571        (self.inner & Self::CORPSE_ALLY) != 0
572    }
573
574    /// pguid, `CanAssist` == true
575    pub const fn new_corpse_ally() -> Self {
576        Self { inner: Self::CORPSE_ALLY }
577    }
578
579    pub fn set_corpse_ally(&mut self) -> Self {
580        self.inner |= Self::CORPSE_ALLY;
581        *self
582    }
583
584    pub fn clear_corpse_ally(&mut self) -> Self {
585        self.inner &= Self::CORPSE_ALLY.reverse_bits();
586        *self
587    }
588
589    pub const fn is_unit_minipet(&self) -> bool {
590        (self.inner & Self::UNIT_MINIPET) != 0
591    }
592
593    /// pguid, not used in any spells as of 2.4.3 (can be set dynamically)
594    pub const fn new_unit_minipet() -> Self {
595        Self { inner: Self::UNIT_MINIPET }
596    }
597
598    pub fn set_unit_minipet(&mut self) -> Self {
599        self.inner |= Self::UNIT_MINIPET;
600        *self
601    }
602
603    pub fn clear_unit_minipet(&mut self) -> Self {
604        self.inner &= Self::UNIT_MINIPET.reverse_bits();
605        *self
606    }
607
608    pub const fn is_glyph_slot(&self) -> bool {
609        (self.inner & Self::GLYPH_SLOT) != 0
610    }
611
612    /// used in glyph spells
613    pub const fn new_glyph_slot() -> Self {
614        Self { inner: Self::GLYPH_SLOT }
615    }
616
617    pub fn set_glyph_slot(&mut self) -> Self {
618        self.inner |= Self::GLYPH_SLOT;
619        *self
620    }
621
622    pub fn clear_glyph_slot(&mut self) -> Self {
623        self.inner &= Self::GLYPH_SLOT.reverse_bits();
624        *self
625    }
626
627    pub const fn is_dest_target(&self) -> bool {
628        (self.inner & Self::DEST_TARGET) != 0
629    }
630
631    /// sometimes appears with `DEST_TARGET` spells (may appear or not for a given spell)
632    pub const fn new_dest_target() -> Self {
633        Self { inner: Self::DEST_TARGET }
634    }
635
636    pub fn set_dest_target(&mut self) -> Self {
637        self.inner |= Self::DEST_TARGET;
638        *self
639    }
640
641    pub fn clear_dest_target(&mut self) -> Self {
642        self.inner &= Self::DEST_TARGET.reverse_bits();
643        *self
644    }
645
646    pub const fn is_unused20(&self) -> bool {
647        (self.inner & Self::UNUSED20) != 0
648    }
649
650    /// uint32 counter loop, vec3 - screen position (?) guid, not used so far
651    pub const fn new_unused20() -> Self {
652        Self { inner: Self::UNUSED20 }
653    }
654
655    pub fn set_unused20(&mut self) -> Self {
656        self.inner |= Self::UNUSED20;
657        *self
658    }
659
660    pub fn clear_unused20(&mut self) -> Self {
661        self.inner &= Self::UNUSED20.reverse_bits();
662        *self
663    }
664
665    pub const fn is_unit_passenger(&self) -> bool {
666        (self.inner & Self::UNIT_PASSENGER) != 0
667    }
668
669    /// guessed, used to validate target (if vehicle passenger)
670    pub const fn new_unit_passenger() -> Self {
671        Self { inner: Self::UNIT_PASSENGER }
672    }
673
674    pub fn set_unit_passenger(&mut self) -> Self {
675        self.inner |= Self::UNIT_PASSENGER;
676        *self
677    }
678
679    pub fn clear_unit_passenger(&mut self) -> Self {
680        self.inner &= Self::UNIT_PASSENGER.reverse_bits();
681        *self
682    }
683
684    pub const fn as_int(&self) -> u32 {
685        self.inner
686    }
687
688}
689
690impl std::fmt::UpperHex for SpellCastTargetFlags {
691    fn fmt(&self, f: &mut std::fmt::Formatter<'_>) -> std::fmt::Result {
692        std::fmt::UpperHex::fmt(&self.inner, f)
693    }
694}
695
696impl std::fmt::LowerHex for SpellCastTargetFlags {
697    fn fmt(&self, f: &mut std::fmt::Formatter<'_>) -> std::fmt::Result {
698        std::fmt::LowerHex::fmt(&self.inner, f)
699    }
700}
701
702impl std::fmt::Octal for SpellCastTargetFlags {
703    fn fmt(&self, f: &mut std::fmt::Formatter<'_>) -> std::fmt::Result {
704        std::fmt::Octal::fmt(&self.inner, f)
705    }
706}
707
708impl std::fmt::Binary for SpellCastTargetFlags {
709    fn fmt(&self, f: &mut std::fmt::Formatter<'_>) -> std::fmt::Result {
710        std::fmt::Binary::fmt(&self.inner, f)
711    }
712}
713
714impl std::ops::BitAnd for SpellCastTargetFlags {
715    type Output = Self;
716    fn bitand(self, rhs: Self) -> Self::Output {
717        Self { inner: self.inner.bitand(rhs.inner), }
718    }
719}
720
721impl std::ops::BitAndAssign for SpellCastTargetFlags {
722    fn bitand_assign(&mut self, rhs: Self) {
723        self.inner.bitand_assign(rhs.inner)
724    }
725}
726
727impl std::ops::BitOr for SpellCastTargetFlags {
728    type Output = Self;
729    fn bitor(self, rhs: Self) -> Self::Output {
730        Self { inner: self.inner.bitor(rhs.inner), }
731    }
732}
733
734impl std::ops::BitOrAssign for SpellCastTargetFlags {
735    fn bitor_assign(&mut self, rhs: Self) {
736        self.inner.bitor_assign(rhs.inner)
737    }
738}
739
740impl std::ops::BitXor for SpellCastTargetFlags {
741    type Output = Self;
742    fn bitxor(self, rhs: Self) -> Self::Output {
743        Self { inner: self.inner.bitxor(rhs.inner), }
744    }
745}
746
747impl std::ops::BitXorAssign for SpellCastTargetFlags {
748    fn bitxor_assign(&mut self, rhs: Self) {
749        self.inner.bitxor_assign(rhs.inner)
750    }
751}
752
753impl From<u32> for SpellCastTargetFlags {
754    fn from(value: u32) -> Self {
755        Self::new(value)
756    }
757}
758
759impl From<u8> for SpellCastTargetFlags {
760    fn from(value: u8) -> Self {
761        Self::new(value.into())
762    }
763}
764
765impl From<u16> for SpellCastTargetFlags {
766    fn from(value: u16) -> Self {
767        Self::new(value.into())
768    }
769}
770
771impl TryFrom<u64> for SpellCastTargetFlags {
772    type Error = u64;
773    fn try_from(value: u64) -> Result<Self, Self::Error> {
774        let a = TryInto::<u32>::try_into(value).ok().ok_or(value)?;
775        Ok(Self::new(a))
776    }
777}
778
779impl TryFrom<i8> for SpellCastTargetFlags {
780    type Error = i8;
781    fn try_from(value: i8) -> Result<Self, Self::Error> {
782        let v = u8::from_le_bytes(value.to_le_bytes());
783        Ok(Self::new(v.into()))
784    }
785}
786
787impl TryFrom<i16> for SpellCastTargetFlags {
788    type Error = i16;
789    fn try_from(value: i16) -> Result<Self, Self::Error> {
790        let v = u16::from_le_bytes(value.to_le_bytes());
791        Ok(Self::new(v.into()))
792    }
793}
794
795impl From<i32> for SpellCastTargetFlags {
796    fn from(value: i32) -> Self {
797        Self::new(u32::from_le_bytes(value.to_le_bytes()))
798    }
799}
800
801impl TryFrom<i64> for SpellCastTargetFlags {
802    type Error = i64;
803    fn try_from(value: i64) -> Result<Self, Self::Error> {
804        let v = u64::from_le_bytes(value.to_le_bytes());
805        let a = TryInto::<u32>::try_into(v).ok().ok_or(value)?;
806        Ok(Self::new(a))
807    }
808}
809
810impl TryFrom<usize> for SpellCastTargetFlags {
811    type Error = usize;
812    fn try_from(value: usize) -> Result<Self, Self::Error> {
813        let a = TryInto::<u32>::try_into(value).ok().ok_or(value)?;
814        Ok(Self::new(a))
815    }
816}
817