wow_world_base 0.3.0

Base definitions and functions for World of Warcraft game servers
Documentation
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
421
422
423
424
425
426
427
428
429
430
431
432
433
434
435
436
437
438
439
440
441
442
443
444
445
446
447
448
449
450
451
452
453
454
455
456
457
458
459
460
461
462
463
464
465
466
467
468
469
470
471
472
473
474
475
476
477
478
479
480
481
482
483
484
485
486
487
488
489
490
491
492
493
494
495
496
497
498
499
500
501
502
503
504
505
506
507
508
509
510
511
512
513
514
515
516
517
518
519
520
521
522
523
524
525
526
527
528
529
530
531
532
533
534
535
536
537
538
539
540
541
542
543
544
545
546
547
548
549
550
551
552
553
554
555
556
557
558
559
560
561
562
563
564
565
566
567
568
569
570
571
572
573
574
575
576
577
578
579
580
581
582
583
584
585
586
587
588
589
590
591
592
593
594
595
596
597
598
599
600
601
602
603
604
605
606
607
608
609
610
611
612
613
614
615
616
617
618
619
620
621
622
623
624
625
626
627
628
629
630
631
632
633
634
635
636
637
638
639
640
641
642
643
644
645
646
647
648
649
650
651
652
653
654
655
656
657
658
659
660
661
662
663
664
665
666
667
668
669
670
671
672
673
674
675
676
677
678
679
680
681
682
683
684
685
686
687
688
689
690
691
692
693
694
695
696
697
698
699
700
701
702
703
704
705
706
707
708
709
710
711
712
713
714
715
716
717
718
719
720
721
722
723
724
725
726
727
728
729
730
731
732
733
734
735
736
737
738
739
740
741
742
743
744
745
746
747
748
749
750
751
752
753
754
755
756
757
758
759
760
761
762
763
764
765
766
767
768
769
770
771
772
773
774
775
776
777
778
779
780
781
782
783
784
785
786
787
/// Auto generated from the original `wowm` in file [`wow_message_parser/wowm/world/social/social_common_3_3_5.wowm:504`](https://github.com/gtker/wow_messages/tree/main/wow_message_parser/wowm/world/social/social_common_3_3_5.wowm#L504):
/// ```text
/// flag GroupUpdateFlags : u32 {
///     NONE = 0x00000000;
///     STATUS = 0x00000001;
///     CUR_HP = 0x00000002;
///     MAX_HP = 0x00000004;
///     POWER_TYPE = 0x00000008;
///     CUR_POWER = 0x00000010;
///     MAX_POWER = 0x00000020;
///     LEVEL = 0x00000040;
///     ZONE = 0x00000080;
///     POSITION = 0x00000100;
///     AURAS = 0x00000200;
///     PET_GUID = 0x00000400;
///     PET_NAME = 0x00000800;
///     PET_MODEL_ID = 0x00001000;
///     PET_CUR_HP = 0x00002000;
///     PET_MAX_HP = 0x00004000;
///     PET_POWER_TYPE = 0x00008000;
///     PET_CUR_POWER = 0x00010000;
///     PET_MAX_POWER = 0x00020000;
///     PET_AURAS = 0x00040000;
///     VEHICLE_SEAT = 0x00080000;
/// }
/// ```
#[derive(Debug, PartialEq, Eq, Hash, Ord, PartialOrd, Copy, Clone, Default)]
#[cfg_attr(feature = "serde", derive(serde::Deserialize, serde::Serialize))]
#[cfg_attr(feature = "serde", serde(transparent))]
pub struct GroupUpdateFlags {
    inner: u32,
}

#[cfg(feature = "print-testcase")]
impl GroupUpdateFlags {
    #[allow(clippy::missing_const_for_fn)]
    pub fn as_test_case_value(&self) -> String {
        let mut s = String::new();
        let mut first = true;
        if self.is_empty() {
            use std::fmt::Write;
            if !first {
                write!(s, " | ").unwrap();
            }
            write!(s, "NONE").unwrap();
            first = false;
        }
        if self.is_status() {
            use std::fmt::Write;
            if !first {
                write!(s, " | ").unwrap();
            }
            write!(s, "STATUS").unwrap();
            first = false;
        }
        if self.is_cur_hp() {
            use std::fmt::Write;
            if !first {
                write!(s, " | ").unwrap();
            }
            write!(s, "CUR_HP").unwrap();
            first = false;
        }
        if self.is_max_hp() {
            use std::fmt::Write;
            if !first {
                write!(s, " | ").unwrap();
            }
            write!(s, "MAX_HP").unwrap();
            first = false;
        }
        if self.is_power_type() {
            use std::fmt::Write;
            if !first {
                write!(s, " | ").unwrap();
            }
            write!(s, "POWER_TYPE").unwrap();
            first = false;
        }
        if self.is_cur_power() {
            use std::fmt::Write;
            if !first {
                write!(s, " | ").unwrap();
            }
            write!(s, "CUR_POWER").unwrap();
            first = false;
        }
        if self.is_max_power() {
            use std::fmt::Write;
            if !first {
                write!(s, " | ").unwrap();
            }
            write!(s, "MAX_POWER").unwrap();
            first = false;
        }
        if self.is_level() {
            use std::fmt::Write;
            if !first {
                write!(s, " | ").unwrap();
            }
            write!(s, "LEVEL").unwrap();
            first = false;
        }
        if self.is_zone() {
            use std::fmt::Write;
            if !first {
                write!(s, " | ").unwrap();
            }
            write!(s, "ZONE").unwrap();
            first = false;
        }
        if self.is_position() {
            use std::fmt::Write;
            if !first {
                write!(s, " | ").unwrap();
            }
            write!(s, "POSITION").unwrap();
            first = false;
        }
        if self.is_auras() {
            use std::fmt::Write;
            if !first {
                write!(s, " | ").unwrap();
            }
            write!(s, "AURAS").unwrap();
            first = false;
        }
        if self.is_pet_guid() {
            use std::fmt::Write;
            if !first {
                write!(s, " | ").unwrap();
            }
            write!(s, "PET_GUID").unwrap();
            first = false;
        }
        if self.is_pet_name() {
            use std::fmt::Write;
            if !first {
                write!(s, " | ").unwrap();
            }
            write!(s, "PET_NAME").unwrap();
            first = false;
        }
        if self.is_pet_model_id() {
            use std::fmt::Write;
            if !first {
                write!(s, " | ").unwrap();
            }
            write!(s, "PET_MODEL_ID").unwrap();
            first = false;
        }
        if self.is_pet_cur_hp() {
            use std::fmt::Write;
            if !first {
                write!(s, " | ").unwrap();
            }
            write!(s, "PET_CUR_HP").unwrap();
            first = false;
        }
        if self.is_pet_max_hp() {
            use std::fmt::Write;
            if !first {
                write!(s, " | ").unwrap();
            }
            write!(s, "PET_MAX_HP").unwrap();
            first = false;
        }
        if self.is_pet_power_type() {
            use std::fmt::Write;
            if !first {
                write!(s, " | ").unwrap();
            }
            write!(s, "PET_POWER_TYPE").unwrap();
            first = false;
        }
        if self.is_pet_cur_power() {
            use std::fmt::Write;
            if !first {
                write!(s, " | ").unwrap();
            }
            write!(s, "PET_CUR_POWER").unwrap();
            first = false;
        }
        if self.is_pet_max_power() {
            use std::fmt::Write;
            if !first {
                write!(s, " | ").unwrap();
            }
            write!(s, "PET_MAX_POWER").unwrap();
            first = false;
        }
        if self.is_pet_auras() {
            use std::fmt::Write;
            if !first {
                write!(s, " | ").unwrap();
            }
            write!(s, "PET_AURAS").unwrap();
            first = false;
        }
        if self.is_vehicle_seat() {
            use std::fmt::Write;
            if !first {
                write!(s, " | ").unwrap();
            }
            write!(s, "VEHICLE_SEAT").unwrap();
            first = false;
        }
        s
    }

}

impl GroupUpdateFlags {
    pub const fn new(inner: u32) -> Self {
        Self { inner }
    }

    pub const NONE: u32 = 0x00;
    pub const STATUS: u32 = 0x01;
    pub const CUR_HP: u32 = 0x02;
    pub const MAX_HP: u32 = 0x04;
    pub const POWER_TYPE: u32 = 0x08;
    pub const CUR_POWER: u32 = 0x10;
    pub const MAX_POWER: u32 = 0x20;
    pub const LEVEL: u32 = 0x40;
    pub const ZONE: u32 = 0x80;
    pub const POSITION: u32 = 0x100;
    pub const AURAS: u32 = 0x200;
    pub const PET_GUID: u32 = 0x400;
    pub const PET_NAME: u32 = 0x800;
    pub const PET_MODEL_ID: u32 = 0x1000;
    pub const PET_CUR_HP: u32 = 0x2000;
    pub const PET_MAX_HP: u32 = 0x4000;
    pub const PET_POWER_TYPE: u32 = 0x8000;
    pub const PET_CUR_POWER: u32 = 0x10000;
    pub const PET_MAX_POWER: u32 = 0x20000;
    pub const PET_AURAS: u32 = 0x40000;
    pub const VEHICLE_SEAT: u32 = 0x80000;

    pub const fn empty() -> Self {
        Self { inner: 0 }
    }

    pub const fn is_empty(&self) -> bool {
        self.inner == 0
    }

    pub const fn all() -> Self {
        Self {
            inner: Self::NONE
                | Self::STATUS
                | Self::CUR_HP
                | Self::MAX_HP
                | Self::POWER_TYPE
                | Self::CUR_POWER
                | Self::MAX_POWER
                | Self::LEVEL
                | Self::ZONE
                | Self::POSITION
                | Self::AURAS
                | Self::PET_GUID
                | Self::PET_NAME
                | Self::PET_MODEL_ID
                | Self::PET_CUR_HP
                | Self::PET_MAX_HP
                | Self::PET_POWER_TYPE
                | Self::PET_CUR_POWER
                | Self::PET_MAX_POWER
                | Self::PET_AURAS
                | Self::VEHICLE_SEAT
        }
    }

    pub const fn is_status(&self) -> bool {
        (self.inner & Self::STATUS) != 0
    }

    /// uint16, flags
    pub const fn new_status() -> Self {
        Self { inner: Self::STATUS }
    }

    pub fn set_status(&mut self) -> Self {
        self.inner |= Self::STATUS;
        *self
    }

    pub fn clear_status(&mut self) -> Self {
        self.inner &= Self::STATUS.reverse_bits();
        *self
    }

    pub const fn is_cur_hp(&self) -> bool {
        (self.inner & Self::CUR_HP) != 0
    }

    /// uint32
    pub const fn new_cur_hp() -> Self {
        Self { inner: Self::CUR_HP }
    }

    pub fn set_cur_hp(&mut self) -> Self {
        self.inner |= Self::CUR_HP;
        *self
    }

    pub fn clear_cur_hp(&mut self) -> Self {
        self.inner &= Self::CUR_HP.reverse_bits();
        *self
    }

    pub const fn is_max_hp(&self) -> bool {
        (self.inner & Self::MAX_HP) != 0
    }

    /// uint32
    pub const fn new_max_hp() -> Self {
        Self { inner: Self::MAX_HP }
    }

    pub fn set_max_hp(&mut self) -> Self {
        self.inner |= Self::MAX_HP;
        *self
    }

    pub fn clear_max_hp(&mut self) -> Self {
        self.inner &= Self::MAX_HP.reverse_bits();
        *self
    }

    pub const fn is_power_type(&self) -> bool {
        (self.inner & Self::POWER_TYPE) != 0
    }

    /// uint8
    pub const fn new_power_type() -> Self {
        Self { inner: Self::POWER_TYPE }
    }

    pub fn set_power_type(&mut self) -> Self {
        self.inner |= Self::POWER_TYPE;
        *self
    }

    pub fn clear_power_type(&mut self) -> Self {
        self.inner &= Self::POWER_TYPE.reverse_bits();
        *self
    }

    pub const fn is_cur_power(&self) -> bool {
        (self.inner & Self::CUR_POWER) != 0
    }

    /// uint16
    pub const fn new_cur_power() -> Self {
        Self { inner: Self::CUR_POWER }
    }

    pub fn set_cur_power(&mut self) -> Self {
        self.inner |= Self::CUR_POWER;
        *self
    }

    pub fn clear_cur_power(&mut self) -> Self {
        self.inner &= Self::CUR_POWER.reverse_bits();
        *self
    }

    pub const fn is_max_power(&self) -> bool {
        (self.inner & Self::MAX_POWER) != 0
    }

    /// uint16
    pub const fn new_max_power() -> Self {
        Self { inner: Self::MAX_POWER }
    }

    pub fn set_max_power(&mut self) -> Self {
        self.inner |= Self::MAX_POWER;
        *self
    }

    pub fn clear_max_power(&mut self) -> Self {
        self.inner &= Self::MAX_POWER.reverse_bits();
        *self
    }

    pub const fn is_level(&self) -> bool {
        (self.inner & Self::LEVEL) != 0
    }

    /// uint16
    pub const fn new_level() -> Self {
        Self { inner: Self::LEVEL }
    }

    pub fn set_level(&mut self) -> Self {
        self.inner |= Self::LEVEL;
        *self
    }

    pub fn clear_level(&mut self) -> Self {
        self.inner &= Self::LEVEL.reverse_bits();
        *self
    }

    pub const fn is_zone(&self) -> bool {
        (self.inner & Self::ZONE) != 0
    }

    /// uint16
    pub const fn new_zone() -> Self {
        Self { inner: Self::ZONE }
    }

    pub fn set_zone(&mut self) -> Self {
        self.inner |= Self::ZONE;
        *self
    }

    pub fn clear_zone(&mut self) -> Self {
        self.inner &= Self::ZONE.reverse_bits();
        *self
    }

    pub const fn is_position(&self) -> bool {
        (self.inner & Self::POSITION) != 0
    }

    /// uint16, uint16
    pub const fn new_position() -> Self {
        Self { inner: Self::POSITION }
    }

    pub fn set_position(&mut self) -> Self {
        self.inner |= Self::POSITION;
        *self
    }

    pub fn clear_position(&mut self) -> Self {
        self.inner &= Self::POSITION.reverse_bits();
        *self
    }

    pub const fn is_auras(&self) -> bool {
        (self.inner & Self::AURAS) != 0
    }

    /// uint64 mask, for each bit set uint32 spellid + uint8 unk
    pub const fn new_auras() -> Self {
        Self { inner: Self::AURAS }
    }

    pub fn set_auras(&mut self) -> Self {
        self.inner |= Self::AURAS;
        *self
    }

    pub fn clear_auras(&mut self) -> Self {
        self.inner &= Self::AURAS.reverse_bits();
        *self
    }

    pub const fn is_pet_guid(&self) -> bool {
        (self.inner & Self::PET_GUID) != 0
    }

    /// uint64 pet guid
    pub const fn new_pet_guid() -> Self {
        Self { inner: Self::PET_GUID }
    }

    pub fn set_pet_guid(&mut self) -> Self {
        self.inner |= Self::PET_GUID;
        *self
    }

    pub fn clear_pet_guid(&mut self) -> Self {
        self.inner &= Self::PET_GUID.reverse_bits();
        *self
    }

    pub const fn is_pet_name(&self) -> bool {
        (self.inner & Self::PET_NAME) != 0
    }

    /// pet name, nullptr terminated string
    pub const fn new_pet_name() -> Self {
        Self { inner: Self::PET_NAME }
    }

    pub fn set_pet_name(&mut self) -> Self {
        self.inner |= Self::PET_NAME;
        *self
    }

    pub fn clear_pet_name(&mut self) -> Self {
        self.inner &= Self::PET_NAME.reverse_bits();
        *self
    }

    pub const fn is_pet_model_id(&self) -> bool {
        (self.inner & Self::PET_MODEL_ID) != 0
    }

    /// uint16, model id
    pub const fn new_pet_model_id() -> Self {
        Self { inner: Self::PET_MODEL_ID }
    }

    pub fn set_pet_model_id(&mut self) -> Self {
        self.inner |= Self::PET_MODEL_ID;
        *self
    }

    pub fn clear_pet_model_id(&mut self) -> Self {
        self.inner &= Self::PET_MODEL_ID.reverse_bits();
        *self
    }

    pub const fn is_pet_cur_hp(&self) -> bool {
        (self.inner & Self::PET_CUR_HP) != 0
    }

    /// uint32 pet cur health
    pub const fn new_pet_cur_hp() -> Self {
        Self { inner: Self::PET_CUR_HP }
    }

    pub fn set_pet_cur_hp(&mut self) -> Self {
        self.inner |= Self::PET_CUR_HP;
        *self
    }

    pub fn clear_pet_cur_hp(&mut self) -> Self {
        self.inner &= Self::PET_CUR_HP.reverse_bits();
        *self
    }

    pub const fn is_pet_max_hp(&self) -> bool {
        (self.inner & Self::PET_MAX_HP) != 0
    }

    /// uint32 pet max health
    pub const fn new_pet_max_hp() -> Self {
        Self { inner: Self::PET_MAX_HP }
    }

    pub fn set_pet_max_hp(&mut self) -> Self {
        self.inner |= Self::PET_MAX_HP;
        *self
    }

    pub fn clear_pet_max_hp(&mut self) -> Self {
        self.inner &= Self::PET_MAX_HP.reverse_bits();
        *self
    }

    pub const fn is_pet_power_type(&self) -> bool {
        (self.inner & Self::PET_POWER_TYPE) != 0
    }

    /// uint8 pet power type
    pub const fn new_pet_power_type() -> Self {
        Self { inner: Self::PET_POWER_TYPE }
    }

    pub fn set_pet_power_type(&mut self) -> Self {
        self.inner |= Self::PET_POWER_TYPE;
        *self
    }

    pub fn clear_pet_power_type(&mut self) -> Self {
        self.inner &= Self::PET_POWER_TYPE.reverse_bits();
        *self
    }

    pub const fn is_pet_cur_power(&self) -> bool {
        (self.inner & Self::PET_CUR_POWER) != 0
    }

    /// uint16 pet cur power
    pub const fn new_pet_cur_power() -> Self {
        Self { inner: Self::PET_CUR_POWER }
    }

    pub fn set_pet_cur_power(&mut self) -> Self {
        self.inner |= Self::PET_CUR_POWER;
        *self
    }

    pub fn clear_pet_cur_power(&mut self) -> Self {
        self.inner &= Self::PET_CUR_POWER.reverse_bits();
        *self
    }

    pub const fn is_pet_max_power(&self) -> bool {
        (self.inner & Self::PET_MAX_POWER) != 0
    }

    /// uint16 pet max power
    pub const fn new_pet_max_power() -> Self {
        Self { inner: Self::PET_MAX_POWER }
    }

    pub fn set_pet_max_power(&mut self) -> Self {
        self.inner |= Self::PET_MAX_POWER;
        *self
    }

    pub fn clear_pet_max_power(&mut self) -> Self {
        self.inner &= Self::PET_MAX_POWER.reverse_bits();
        *self
    }

    pub const fn is_pet_auras(&self) -> bool {
        (self.inner & Self::PET_AURAS) != 0
    }

    /// uint64 mask, for each bit set uint32 spellid + uint8 unk, pet auras...
    pub const fn new_pet_auras() -> Self {
        Self { inner: Self::PET_AURAS }
    }

    pub fn set_pet_auras(&mut self) -> Self {
        self.inner |= Self::PET_AURAS;
        *self
    }

    pub fn clear_pet_auras(&mut self) -> Self {
        self.inner &= Self::PET_AURAS.reverse_bits();
        *self
    }

    pub const fn is_vehicle_seat(&self) -> bool {
        (self.inner & Self::VEHICLE_SEAT) != 0
    }

    /// uint32 `vehicle_seat_id` (index from VehicleSeat.dbc)
    pub const fn new_vehicle_seat() -> Self {
        Self { inner: Self::VEHICLE_SEAT }
    }

    pub fn set_vehicle_seat(&mut self) -> Self {
        self.inner |= Self::VEHICLE_SEAT;
        *self
    }

    pub fn clear_vehicle_seat(&mut self) -> Self {
        self.inner &= Self::VEHICLE_SEAT.reverse_bits();
        *self
    }

    pub const fn as_int(&self) -> u32 {
        self.inner
    }

}

impl std::fmt::UpperHex for GroupUpdateFlags {
    fn fmt(&self, f: &mut std::fmt::Formatter<'_>) -> std::fmt::Result {
        std::fmt::UpperHex::fmt(&self.inner, f)
    }
}

impl std::fmt::LowerHex for GroupUpdateFlags {
    fn fmt(&self, f: &mut std::fmt::Formatter<'_>) -> std::fmt::Result {
        std::fmt::LowerHex::fmt(&self.inner, f)
    }
}

impl std::fmt::Octal for GroupUpdateFlags {
    fn fmt(&self, f: &mut std::fmt::Formatter<'_>) -> std::fmt::Result {
        std::fmt::Octal::fmt(&self.inner, f)
    }
}

impl std::fmt::Binary for GroupUpdateFlags {
    fn fmt(&self, f: &mut std::fmt::Formatter<'_>) -> std::fmt::Result {
        std::fmt::Binary::fmt(&self.inner, f)
    }
}

impl std::ops::BitAnd for GroupUpdateFlags {
    type Output = Self;
    fn bitand(self, rhs: Self) -> Self::Output {
        Self { inner: self.inner.bitand(rhs.inner), }
    }
}

impl std::ops::BitAndAssign for GroupUpdateFlags {
    fn bitand_assign(&mut self, rhs: Self) {
        self.inner.bitand_assign(rhs.inner)
    }
}

impl std::ops::BitOr for GroupUpdateFlags {
    type Output = Self;
    fn bitor(self, rhs: Self) -> Self::Output {
        Self { inner: self.inner.bitor(rhs.inner), }
    }
}

impl std::ops::BitOrAssign for GroupUpdateFlags {
    fn bitor_assign(&mut self, rhs: Self) {
        self.inner.bitor_assign(rhs.inner)
    }
}

impl std::ops::BitXor for GroupUpdateFlags {
    type Output = Self;
    fn bitxor(self, rhs: Self) -> Self::Output {
        Self { inner: self.inner.bitxor(rhs.inner), }
    }
}

impl std::ops::BitXorAssign for GroupUpdateFlags {
    fn bitxor_assign(&mut self, rhs: Self) {
        self.inner.bitxor_assign(rhs.inner)
    }
}

impl From<u32> for GroupUpdateFlags {
    fn from(value: u32) -> Self {
        Self::new(value)
    }
}

impl From<u8> for GroupUpdateFlags {
    fn from(value: u8) -> Self {
        Self::new(value.into())
    }
}

impl From<u16> for GroupUpdateFlags {
    fn from(value: u16) -> Self {
        Self::new(value.into())
    }
}

impl TryFrom<u64> for GroupUpdateFlags {
    type Error = u64;
    fn try_from(value: u64) -> Result<Self, Self::Error> {
        let a = TryInto::<u32>::try_into(value).ok().ok_or(value)?;
        Ok(Self::new(a))
    }
}

impl TryFrom<i8> for GroupUpdateFlags {
    type Error = i8;
    fn try_from(value: i8) -> Result<Self, Self::Error> {
        let v = u8::from_le_bytes(value.to_le_bytes());
        Ok(Self::new(v.into()))
    }
}

impl TryFrom<i16> for GroupUpdateFlags {
    type Error = i16;
    fn try_from(value: i16) -> Result<Self, Self::Error> {
        let v = u16::from_le_bytes(value.to_le_bytes());
        Ok(Self::new(v.into()))
    }
}

impl From<i32> for GroupUpdateFlags {
    fn from(value: i32) -> Self {
        Self::new(u32::from_le_bytes(value.to_le_bytes()))
    }
}

impl TryFrom<i64> for GroupUpdateFlags {
    type Error = i64;
    fn try_from(value: i64) -> Result<Self, Self::Error> {
        let v = u64::from_le_bytes(value.to_le_bytes());
        let a = TryInto::<u32>::try_into(v).ok().ok_or(value)?;
        Ok(Self::new(a))
    }
}

impl TryFrom<usize> for GroupUpdateFlags {
    type Error = usize;
    fn try_from(value: usize) -> Result<Self, Self::Error> {
        let a = TryInto::<u32>::try_into(value).ok().ok_or(value)?;
        Ok(Self::new(a))
    }
}