1use crate::{BVec2, UVec3};
4
5#[cfg(feature = "u8")]
6use crate::U8Vec2;
7
8#[cfg(feature = "u16")]
9use crate::U16Vec2;
10
11#[cfg(feature = "i8")]
12use crate::I8Vec2;
13
14#[cfg(feature = "i16")]
15use crate::I16Vec2;
16
17#[cfg(feature = "i32")]
18use crate::IVec2;
19
20#[cfg(feature = "i64")]
21use crate::I64Vec2;
22
23#[cfg(feature = "u64")]
24use crate::U64Vec2;
25
26#[cfg(feature = "isize")]
27use crate::ISizeVec2;
28
29#[cfg(feature = "usize")]
30use crate::USizeVec2;
31
32use core::fmt;
33use core::iter::{Product, Sum};
34use core::ops::*;
35
36#[cfg(feature = "zerocopy-08")]
37use zerocopy_derive_08::*;
38
39#[inline(always)]
41#[must_use]
42pub const fn uvec2(x: u32, y: u32) -> UVec2 {
43 UVec2::new(x, y)
44}
45
46#[derive(Clone, Copy, PartialEq, Eq, Hash)]
48#[cfg_attr(feature = "bytemuck", derive(bytemuck::Pod, bytemuck::Zeroable))]
49#[cfg_attr(
50 feature = "zerocopy-08",
51 derive(FromBytes, Immutable, IntoBytes, KnownLayout)
52)]
53#[cfg_attr(feature = "cuda", repr(align(8)))]
54#[repr(C)]
55#[cfg_attr(target_arch = "spirv", rust_gpu::vector::v1)]
56pub struct UVec2 {
57 pub x: u32,
58 pub y: u32,
59}
60
61impl UVec2 {
62 pub const ZERO: Self = Self::splat(0);
64
65 pub const ONE: Self = Self::splat(1);
67
68 pub const MIN: Self = Self::splat(u32::MIN);
70
71 pub const MAX: Self = Self::splat(u32::MAX);
73
74 pub const X: Self = Self::new(1, 0);
76
77 pub const Y: Self = Self::new(0, 1);
79
80 pub const AXES: [Self; 2] = [Self::X, Self::Y];
82
83 #[inline(always)]
85 #[must_use]
86 pub const fn new(x: u32, y: u32) -> Self {
87 Self { x, y }
88 }
89
90 #[inline]
92 #[must_use]
93 pub const fn splat(v: u32) -> Self {
94 Self::new(v, v)
95 }
96
97 #[inline]
99 #[must_use]
100 pub fn map<F>(self, mut f: F) -> Self
101 where
102 F: FnMut(u32) -> u32,
103 {
104 Self::new(f(self.x), f(self.y))
105 }
106
107 #[inline]
113 #[must_use]
114 pub fn select(mask: BVec2, if_true: Self, if_false: Self) -> Self {
115 Self::new(
116 if mask.test(0) { if_true.x } else { if_false.x },
117 if mask.test(1) { if_true.y } else { if_false.y },
118 )
119 }
120
121 #[inline]
123 #[must_use]
124 pub const fn from_array(a: [u32; 2]) -> Self {
125 Self::new(a[0], a[1])
126 }
127
128 #[inline]
130 #[must_use]
131 pub const fn to_array(&self) -> [u32; 2] {
132 [self.x, self.y]
133 }
134
135 #[inline]
141 #[must_use]
142 #[track_caller]
143 pub const fn from_slice(slice: &[u32]) -> Self {
144 assert!(slice.len() >= 2);
145 Self::new(slice[0], slice[1])
146 }
147
148 #[inline]
154 #[track_caller]
155 pub fn write_to_slice(self, slice: &mut [u32]) {
156 slice[..2].copy_from_slice(&self.to_array());
157 }
158
159 #[inline]
161 #[must_use]
162 pub const fn extend(self, z: u32) -> UVec3 {
163 UVec3::new(self.x, self.y, z)
164 }
165
166 #[inline]
168 #[must_use]
169 pub fn with_x(mut self, x: u32) -> Self {
170 self.x = x;
171 self
172 }
173
174 #[inline]
176 #[must_use]
177 pub fn with_y(mut self, y: u32) -> Self {
178 self.y = y;
179 self
180 }
181
182 #[inline]
184 #[must_use]
185 pub fn dot(self, rhs: Self) -> u32 {
186 (self.x * rhs.x) + (self.y * rhs.y)
187 }
188
189 #[inline]
191 #[must_use]
192 pub fn dot_into_vec(self, rhs: Self) -> Self {
193 Self::splat(self.dot(rhs))
194 }
195
196 #[inline]
200 #[must_use]
201 pub fn min(self, rhs: Self) -> Self {
202 Self::new(
203 if self.x < rhs.x { self.x } else { rhs.x },
204 if self.y < rhs.y { self.y } else { rhs.y },
205 )
206 }
207
208 #[inline]
212 #[must_use]
213 pub fn max(self, rhs: Self) -> Self {
214 Self::new(
215 if self.x > rhs.x { self.x } else { rhs.x },
216 if self.y > rhs.y { self.y } else { rhs.y },
217 )
218 }
219
220 #[inline]
228 #[must_use]
229 #[cfg_attr(any(debug_assertions, feature = "glam-assert"), track_caller)]
230 pub fn clamp(self, min: Self, max: Self) -> Self {
231 glam_assert!(min.cmple(max).all(), "clamp: expected min <= max");
232 self.max(min).min(max)
233 }
234
235 #[inline]
239 #[must_use]
240 pub fn min_element(self) -> u32 {
241 let min = |a, b| if a < b { a } else { b };
242 min(self.x, self.y)
243 }
244
245 #[inline]
249 #[must_use]
250 pub fn max_element(self) -> u32 {
251 let max = |a, b| if a > b { a } else { b };
252 max(self.x, self.y)
253 }
254
255 #[doc(alias = "argmin")]
257 #[inline]
258 #[must_use]
259 pub fn min_position(self) -> usize {
260 if self.x <= self.y { 0 } else { 1 }
261 }
262
263 #[doc(alias = "argmax")]
265 #[inline]
266 #[must_use]
267 pub fn max_position(self) -> usize {
268 if self.x >= self.y { 0 } else { 1 }
269 }
270
271 #[inline]
275 #[must_use]
276 pub fn element_sum(self) -> u32 {
277 self.x + self.y
278 }
279
280 #[inline]
284 #[must_use]
285 pub fn element_product(self) -> u32 {
286 self.x * self.y
287 }
288
289 #[inline]
295 #[must_use]
296 pub fn cmpeq(self, rhs: Self) -> BVec2 {
297 BVec2::new(self.x.eq(&rhs.x), self.y.eq(&rhs.y))
298 }
299
300 #[inline]
306 #[must_use]
307 pub fn cmpne(self, rhs: Self) -> BVec2 {
308 BVec2::new(self.x.ne(&rhs.x), self.y.ne(&rhs.y))
309 }
310
311 #[inline]
317 #[must_use]
318 pub fn cmpge(self, rhs: Self) -> BVec2 {
319 BVec2::new(self.x.ge(&rhs.x), self.y.ge(&rhs.y))
320 }
321
322 #[inline]
328 #[must_use]
329 pub fn cmpgt(self, rhs: Self) -> BVec2 {
330 BVec2::new(self.x.gt(&rhs.x), self.y.gt(&rhs.y))
331 }
332
333 #[inline]
339 #[must_use]
340 pub fn cmple(self, rhs: Self) -> BVec2 {
341 BVec2::new(self.x.le(&rhs.x), self.y.le(&rhs.y))
342 }
343
344 #[inline]
350 #[must_use]
351 pub fn cmplt(self, rhs: Self) -> BVec2 {
352 BVec2::new(self.x.lt(&rhs.x), self.y.lt(&rhs.y))
353 }
354
355 #[doc(alias = "magnitude2")]
357 #[inline]
358 #[must_use]
359 pub fn length_squared(self) -> u32 {
360 self.dot(self)
361 }
362
363 #[inline]
372 #[must_use]
373 pub fn manhattan_distance(self, rhs: Self) -> u32 {
374 self.x.abs_diff(rhs.x) + self.y.abs_diff(rhs.y)
375 }
376
377 #[inline]
383 #[must_use]
384 pub fn checked_manhattan_distance(self, rhs: Self) -> Option<u32> {
385 let d = self.x.abs_diff(rhs.x);
386 d.checked_add(self.y.abs_diff(rhs.y))
387 }
388
389 #[inline]
393 #[must_use]
394 pub fn chebyshev_distance(self, rhs: Self) -> u32 {
395 [self.x.abs_diff(rhs.x), self.y.abs_diff(rhs.y)]
397 .into_iter()
398 .max()
399 .unwrap()
400 }
401
402 #[inline]
404 #[must_use]
405 pub fn as_vec2(self) -> crate::Vec2 {
406 crate::Vec2::new(self.x as f32, self.y as f32)
407 }
408
409 #[cfg(feature = "f64")]
411 #[inline]
412 #[must_use]
413 pub fn as_dvec2(self) -> crate::DVec2 {
414 crate::DVec2::new(self.x as f64, self.y as f64)
415 }
416
417 #[cfg(feature = "i8")]
419 #[inline]
420 #[must_use]
421 pub fn as_i8vec2(self) -> crate::I8Vec2 {
422 crate::I8Vec2::new(self.x as i8, self.y as i8)
423 }
424
425 #[cfg(feature = "u8")]
427 #[inline]
428 #[must_use]
429 pub fn as_u8vec2(self) -> crate::U8Vec2 {
430 crate::U8Vec2::new(self.x as u8, self.y as u8)
431 }
432
433 #[cfg(feature = "i16")]
435 #[inline]
436 #[must_use]
437 pub fn as_i16vec2(self) -> crate::I16Vec2 {
438 crate::I16Vec2::new(self.x as i16, self.y as i16)
439 }
440
441 #[cfg(feature = "u16")]
443 #[inline]
444 #[must_use]
445 pub fn as_u16vec2(self) -> crate::U16Vec2 {
446 crate::U16Vec2::new(self.x as u16, self.y as u16)
447 }
448
449 #[cfg(feature = "i32")]
451 #[inline]
452 #[must_use]
453 pub fn as_ivec2(self) -> crate::IVec2 {
454 crate::IVec2::new(self.x as i32, self.y as i32)
455 }
456
457 #[cfg(feature = "i64")]
459 #[inline]
460 #[must_use]
461 pub fn as_i64vec2(self) -> crate::I64Vec2 {
462 crate::I64Vec2::new(self.x as i64, self.y as i64)
463 }
464
465 #[cfg(feature = "u64")]
467 #[inline]
468 #[must_use]
469 pub fn as_u64vec2(self) -> crate::U64Vec2 {
470 crate::U64Vec2::new(self.x as u64, self.y as u64)
471 }
472
473 #[cfg(feature = "isize")]
475 #[inline]
476 #[must_use]
477 pub fn as_isizevec2(self) -> crate::ISizeVec2 {
478 crate::ISizeVec2::new(self.x as isize, self.y as isize)
479 }
480
481 #[cfg(feature = "usize")]
483 #[inline]
484 #[must_use]
485 pub fn as_usizevec2(self) -> crate::USizeVec2 {
486 crate::USizeVec2::new(self.x as usize, self.y as usize)
487 }
488
489 #[inline]
493 #[must_use]
494 pub const fn checked_add(self, rhs: Self) -> Option<Self> {
495 let x = match self.x.checked_add(rhs.x) {
496 Some(v) => v,
497 None => return None,
498 };
499 let y = match self.y.checked_add(rhs.y) {
500 Some(v) => v,
501 None => return None,
502 };
503
504 Some(Self { x, y })
505 }
506
507 #[inline]
511 #[must_use]
512 pub const fn checked_sub(self, rhs: Self) -> Option<Self> {
513 let x = match self.x.checked_sub(rhs.x) {
514 Some(v) => v,
515 None => return None,
516 };
517 let y = match self.y.checked_sub(rhs.y) {
518 Some(v) => v,
519 None => return None,
520 };
521
522 Some(Self { x, y })
523 }
524
525 #[inline]
529 #[must_use]
530 pub const fn checked_mul(self, rhs: Self) -> Option<Self> {
531 let x = match self.x.checked_mul(rhs.x) {
532 Some(v) => v,
533 None => return None,
534 };
535 let y = match self.y.checked_mul(rhs.y) {
536 Some(v) => v,
537 None => return None,
538 };
539
540 Some(Self { x, y })
541 }
542
543 #[inline]
547 #[must_use]
548 pub const fn checked_div(self, rhs: Self) -> Option<Self> {
549 let x = match self.x.checked_div(rhs.x) {
550 Some(v) => v,
551 None => return None,
552 };
553 let y = match self.y.checked_div(rhs.y) {
554 Some(v) => v,
555 None => return None,
556 };
557
558 Some(Self { x, y })
559 }
560
561 #[inline]
565 #[must_use]
566 pub const fn wrapping_add(self, rhs: Self) -> Self {
567 Self {
568 x: self.x.wrapping_add(rhs.x),
569 y: self.y.wrapping_add(rhs.y),
570 }
571 }
572
573 #[inline]
577 #[must_use]
578 pub const fn wrapping_sub(self, rhs: Self) -> Self {
579 Self {
580 x: self.x.wrapping_sub(rhs.x),
581 y: self.y.wrapping_sub(rhs.y),
582 }
583 }
584
585 #[inline]
589 #[must_use]
590 pub const fn wrapping_mul(self, rhs: Self) -> Self {
591 Self {
592 x: self.x.wrapping_mul(rhs.x),
593 y: self.y.wrapping_mul(rhs.y),
594 }
595 }
596
597 #[inline]
601 #[must_use]
602 pub const fn wrapping_div(self, rhs: Self) -> Self {
603 Self {
604 x: self.x.wrapping_div(rhs.x),
605 y: self.y.wrapping_div(rhs.y),
606 }
607 }
608
609 #[inline]
613 #[must_use]
614 pub const fn saturating_add(self, rhs: Self) -> Self {
615 Self {
616 x: self.x.saturating_add(rhs.x),
617 y: self.y.saturating_add(rhs.y),
618 }
619 }
620
621 #[inline]
625 #[must_use]
626 pub const fn saturating_sub(self, rhs: Self) -> Self {
627 Self {
628 x: self.x.saturating_sub(rhs.x),
629 y: self.y.saturating_sub(rhs.y),
630 }
631 }
632
633 #[inline]
637 #[must_use]
638 pub const fn saturating_mul(self, rhs: Self) -> Self {
639 Self {
640 x: self.x.saturating_mul(rhs.x),
641 y: self.y.saturating_mul(rhs.y),
642 }
643 }
644
645 #[inline]
649 #[must_use]
650 pub const fn saturating_div(self, rhs: Self) -> Self {
651 Self {
652 x: self.x.saturating_div(rhs.x),
653 y: self.y.saturating_div(rhs.y),
654 }
655 }
656
657 #[cfg(feature = "i32")]
661 #[inline]
662 #[must_use]
663 pub const fn checked_add_signed(self, rhs: IVec2) -> Option<Self> {
664 let x = match self.x.checked_add_signed(rhs.x) {
665 Some(v) => v,
666 None => return None,
667 };
668 let y = match self.y.checked_add_signed(rhs.y) {
669 Some(v) => v,
670 None => return None,
671 };
672
673 Some(Self { x, y })
674 }
675
676 #[cfg(feature = "i32")]
680 #[inline]
681 #[must_use]
682 pub const fn wrapping_add_signed(self, rhs: IVec2) -> Self {
683 Self {
684 x: self.x.wrapping_add_signed(rhs.x),
685 y: self.y.wrapping_add_signed(rhs.y),
686 }
687 }
688
689 #[cfg(feature = "i32")]
693 #[inline]
694 #[must_use]
695 pub const fn saturating_add_signed(self, rhs: IVec2) -> Self {
696 Self {
697 x: self.x.saturating_add_signed(rhs.x),
698 y: self.y.saturating_add_signed(rhs.y),
699 }
700 }
701}
702
703impl Default for UVec2 {
704 #[inline(always)]
705 fn default() -> Self {
706 Self::ZERO
707 }
708}
709
710impl Div for UVec2 {
711 type Output = Self;
712 #[inline]
713 fn div(self, rhs: Self) -> Self {
714 Self::new(self.x.div(rhs.x), self.y.div(rhs.y))
715 }
716}
717
718impl Div<&Self> for UVec2 {
719 type Output = Self;
720 #[inline]
721 fn div(self, rhs: &Self) -> Self {
722 self.div(*rhs)
723 }
724}
725
726impl Div<&UVec2> for &UVec2 {
727 type Output = UVec2;
728 #[inline]
729 fn div(self, rhs: &UVec2) -> UVec2 {
730 (*self).div(*rhs)
731 }
732}
733
734impl Div<UVec2> for &UVec2 {
735 type Output = UVec2;
736 #[inline]
737 fn div(self, rhs: UVec2) -> UVec2 {
738 (*self).div(rhs)
739 }
740}
741
742impl DivAssign for UVec2 {
743 #[inline]
744 fn div_assign(&mut self, rhs: Self) {
745 self.x.div_assign(rhs.x);
746 self.y.div_assign(rhs.y);
747 }
748}
749
750impl DivAssign<&Self> for UVec2 {
751 #[inline]
752 fn div_assign(&mut self, rhs: &Self) {
753 self.div_assign(*rhs);
754 }
755}
756
757impl Div<u32> for UVec2 {
758 type Output = Self;
759 #[inline]
760 fn div(self, rhs: u32) -> Self {
761 Self::new(self.x.div(rhs), self.y.div(rhs))
762 }
763}
764
765impl Div<&u32> for UVec2 {
766 type Output = Self;
767 #[inline]
768 fn div(self, rhs: &u32) -> Self {
769 self.div(*rhs)
770 }
771}
772
773impl Div<&u32> for &UVec2 {
774 type Output = UVec2;
775 #[inline]
776 fn div(self, rhs: &u32) -> UVec2 {
777 (*self).div(*rhs)
778 }
779}
780
781impl Div<u32> for &UVec2 {
782 type Output = UVec2;
783 #[inline]
784 fn div(self, rhs: u32) -> UVec2 {
785 (*self).div(rhs)
786 }
787}
788
789impl DivAssign<u32> for UVec2 {
790 #[inline]
791 fn div_assign(&mut self, rhs: u32) {
792 self.x.div_assign(rhs);
793 self.y.div_assign(rhs);
794 }
795}
796
797impl DivAssign<&u32> for UVec2 {
798 #[inline]
799 fn div_assign(&mut self, rhs: &u32) {
800 self.div_assign(*rhs);
801 }
802}
803
804impl Div<UVec2> for u32 {
805 type Output = UVec2;
806 #[inline]
807 fn div(self, rhs: UVec2) -> UVec2 {
808 UVec2::new(self.div(rhs.x), self.div(rhs.y))
809 }
810}
811
812impl Div<&UVec2> for u32 {
813 type Output = UVec2;
814 #[inline]
815 fn div(self, rhs: &UVec2) -> UVec2 {
816 self.div(*rhs)
817 }
818}
819
820impl Div<&UVec2> for &u32 {
821 type Output = UVec2;
822 #[inline]
823 fn div(self, rhs: &UVec2) -> UVec2 {
824 (*self).div(*rhs)
825 }
826}
827
828impl Div<UVec2> for &u32 {
829 type Output = UVec2;
830 #[inline]
831 fn div(self, rhs: UVec2) -> UVec2 {
832 (*self).div(rhs)
833 }
834}
835
836impl Mul for UVec2 {
837 type Output = Self;
838 #[inline]
839 fn mul(self, rhs: Self) -> Self {
840 Self::new(self.x.mul(rhs.x), self.y.mul(rhs.y))
841 }
842}
843
844impl Mul<&Self> for UVec2 {
845 type Output = Self;
846 #[inline]
847 fn mul(self, rhs: &Self) -> Self {
848 self.mul(*rhs)
849 }
850}
851
852impl Mul<&UVec2> for &UVec2 {
853 type Output = UVec2;
854 #[inline]
855 fn mul(self, rhs: &UVec2) -> UVec2 {
856 (*self).mul(*rhs)
857 }
858}
859
860impl Mul<UVec2> for &UVec2 {
861 type Output = UVec2;
862 #[inline]
863 fn mul(self, rhs: UVec2) -> UVec2 {
864 (*self).mul(rhs)
865 }
866}
867
868impl MulAssign for UVec2 {
869 #[inline]
870 fn mul_assign(&mut self, rhs: Self) {
871 self.x.mul_assign(rhs.x);
872 self.y.mul_assign(rhs.y);
873 }
874}
875
876impl MulAssign<&Self> for UVec2 {
877 #[inline]
878 fn mul_assign(&mut self, rhs: &Self) {
879 self.mul_assign(*rhs);
880 }
881}
882
883impl Mul<u32> for UVec2 {
884 type Output = Self;
885 #[inline]
886 fn mul(self, rhs: u32) -> Self {
887 Self::new(self.x.mul(rhs), self.y.mul(rhs))
888 }
889}
890
891impl Mul<&u32> for UVec2 {
892 type Output = Self;
893 #[inline]
894 fn mul(self, rhs: &u32) -> Self {
895 self.mul(*rhs)
896 }
897}
898
899impl Mul<&u32> for &UVec2 {
900 type Output = UVec2;
901 #[inline]
902 fn mul(self, rhs: &u32) -> UVec2 {
903 (*self).mul(*rhs)
904 }
905}
906
907impl Mul<u32> for &UVec2 {
908 type Output = UVec2;
909 #[inline]
910 fn mul(self, rhs: u32) -> UVec2 {
911 (*self).mul(rhs)
912 }
913}
914
915impl MulAssign<u32> for UVec2 {
916 #[inline]
917 fn mul_assign(&mut self, rhs: u32) {
918 self.x.mul_assign(rhs);
919 self.y.mul_assign(rhs);
920 }
921}
922
923impl MulAssign<&u32> for UVec2 {
924 #[inline]
925 fn mul_assign(&mut self, rhs: &u32) {
926 self.mul_assign(*rhs);
927 }
928}
929
930impl Mul<UVec2> for u32 {
931 type Output = UVec2;
932 #[inline]
933 fn mul(self, rhs: UVec2) -> UVec2 {
934 UVec2::new(self.mul(rhs.x), self.mul(rhs.y))
935 }
936}
937
938impl Mul<&UVec2> for u32 {
939 type Output = UVec2;
940 #[inline]
941 fn mul(self, rhs: &UVec2) -> UVec2 {
942 self.mul(*rhs)
943 }
944}
945
946impl Mul<&UVec2> for &u32 {
947 type Output = UVec2;
948 #[inline]
949 fn mul(self, rhs: &UVec2) -> UVec2 {
950 (*self).mul(*rhs)
951 }
952}
953
954impl Mul<UVec2> for &u32 {
955 type Output = UVec2;
956 #[inline]
957 fn mul(self, rhs: UVec2) -> UVec2 {
958 (*self).mul(rhs)
959 }
960}
961
962impl Add for UVec2 {
963 type Output = Self;
964 #[inline]
965 fn add(self, rhs: Self) -> Self {
966 Self::new(self.x.add(rhs.x), self.y.add(rhs.y))
967 }
968}
969
970impl Add<&Self> for UVec2 {
971 type Output = Self;
972 #[inline]
973 fn add(self, rhs: &Self) -> Self {
974 self.add(*rhs)
975 }
976}
977
978impl Add<&UVec2> for &UVec2 {
979 type Output = UVec2;
980 #[inline]
981 fn add(self, rhs: &UVec2) -> UVec2 {
982 (*self).add(*rhs)
983 }
984}
985
986impl Add<UVec2> for &UVec2 {
987 type Output = UVec2;
988 #[inline]
989 fn add(self, rhs: UVec2) -> UVec2 {
990 (*self).add(rhs)
991 }
992}
993
994impl AddAssign for UVec2 {
995 #[inline]
996 fn add_assign(&mut self, rhs: Self) {
997 self.x.add_assign(rhs.x);
998 self.y.add_assign(rhs.y);
999 }
1000}
1001
1002impl AddAssign<&Self> for UVec2 {
1003 #[inline]
1004 fn add_assign(&mut self, rhs: &Self) {
1005 self.add_assign(*rhs);
1006 }
1007}
1008
1009impl Add<u32> for UVec2 {
1010 type Output = Self;
1011 #[inline]
1012 fn add(self, rhs: u32) -> Self {
1013 Self::new(self.x.add(rhs), self.y.add(rhs))
1014 }
1015}
1016
1017impl Add<&u32> for UVec2 {
1018 type Output = Self;
1019 #[inline]
1020 fn add(self, rhs: &u32) -> Self {
1021 self.add(*rhs)
1022 }
1023}
1024
1025impl Add<&u32> for &UVec2 {
1026 type Output = UVec2;
1027 #[inline]
1028 fn add(self, rhs: &u32) -> UVec2 {
1029 (*self).add(*rhs)
1030 }
1031}
1032
1033impl Add<u32> for &UVec2 {
1034 type Output = UVec2;
1035 #[inline]
1036 fn add(self, rhs: u32) -> UVec2 {
1037 (*self).add(rhs)
1038 }
1039}
1040
1041impl AddAssign<u32> for UVec2 {
1042 #[inline]
1043 fn add_assign(&mut self, rhs: u32) {
1044 self.x.add_assign(rhs);
1045 self.y.add_assign(rhs);
1046 }
1047}
1048
1049impl AddAssign<&u32> for UVec2 {
1050 #[inline]
1051 fn add_assign(&mut self, rhs: &u32) {
1052 self.add_assign(*rhs);
1053 }
1054}
1055
1056impl Add<UVec2> for u32 {
1057 type Output = UVec2;
1058 #[inline]
1059 fn add(self, rhs: UVec2) -> UVec2 {
1060 UVec2::new(self.add(rhs.x), self.add(rhs.y))
1061 }
1062}
1063
1064impl Add<&UVec2> for u32 {
1065 type Output = UVec2;
1066 #[inline]
1067 fn add(self, rhs: &UVec2) -> UVec2 {
1068 self.add(*rhs)
1069 }
1070}
1071
1072impl Add<&UVec2> for &u32 {
1073 type Output = UVec2;
1074 #[inline]
1075 fn add(self, rhs: &UVec2) -> UVec2 {
1076 (*self).add(*rhs)
1077 }
1078}
1079
1080impl Add<UVec2> for &u32 {
1081 type Output = UVec2;
1082 #[inline]
1083 fn add(self, rhs: UVec2) -> UVec2 {
1084 (*self).add(rhs)
1085 }
1086}
1087
1088impl Sub for UVec2 {
1089 type Output = Self;
1090 #[inline]
1091 fn sub(self, rhs: Self) -> Self {
1092 Self::new(self.x.sub(rhs.x), self.y.sub(rhs.y))
1093 }
1094}
1095
1096impl Sub<&Self> for UVec2 {
1097 type Output = Self;
1098 #[inline]
1099 fn sub(self, rhs: &Self) -> Self {
1100 self.sub(*rhs)
1101 }
1102}
1103
1104impl Sub<&UVec2> for &UVec2 {
1105 type Output = UVec2;
1106 #[inline]
1107 fn sub(self, rhs: &UVec2) -> UVec2 {
1108 (*self).sub(*rhs)
1109 }
1110}
1111
1112impl Sub<UVec2> for &UVec2 {
1113 type Output = UVec2;
1114 #[inline]
1115 fn sub(self, rhs: UVec2) -> UVec2 {
1116 (*self).sub(rhs)
1117 }
1118}
1119
1120impl SubAssign for UVec2 {
1121 #[inline]
1122 fn sub_assign(&mut self, rhs: Self) {
1123 self.x.sub_assign(rhs.x);
1124 self.y.sub_assign(rhs.y);
1125 }
1126}
1127
1128impl SubAssign<&Self> for UVec2 {
1129 #[inline]
1130 fn sub_assign(&mut self, rhs: &Self) {
1131 self.sub_assign(*rhs);
1132 }
1133}
1134
1135impl Sub<u32> for UVec2 {
1136 type Output = Self;
1137 #[inline]
1138 fn sub(self, rhs: u32) -> Self {
1139 Self::new(self.x.sub(rhs), self.y.sub(rhs))
1140 }
1141}
1142
1143impl Sub<&u32> for UVec2 {
1144 type Output = Self;
1145 #[inline]
1146 fn sub(self, rhs: &u32) -> Self {
1147 self.sub(*rhs)
1148 }
1149}
1150
1151impl Sub<&u32> for &UVec2 {
1152 type Output = UVec2;
1153 #[inline]
1154 fn sub(self, rhs: &u32) -> UVec2 {
1155 (*self).sub(*rhs)
1156 }
1157}
1158
1159impl Sub<u32> for &UVec2 {
1160 type Output = UVec2;
1161 #[inline]
1162 fn sub(self, rhs: u32) -> UVec2 {
1163 (*self).sub(rhs)
1164 }
1165}
1166
1167impl SubAssign<u32> for UVec2 {
1168 #[inline]
1169 fn sub_assign(&mut self, rhs: u32) {
1170 self.x.sub_assign(rhs);
1171 self.y.sub_assign(rhs);
1172 }
1173}
1174
1175impl SubAssign<&u32> for UVec2 {
1176 #[inline]
1177 fn sub_assign(&mut self, rhs: &u32) {
1178 self.sub_assign(*rhs);
1179 }
1180}
1181
1182impl Sub<UVec2> for u32 {
1183 type Output = UVec2;
1184 #[inline]
1185 fn sub(self, rhs: UVec2) -> UVec2 {
1186 UVec2::new(self.sub(rhs.x), self.sub(rhs.y))
1187 }
1188}
1189
1190impl Sub<&UVec2> for u32 {
1191 type Output = UVec2;
1192 #[inline]
1193 fn sub(self, rhs: &UVec2) -> UVec2 {
1194 self.sub(*rhs)
1195 }
1196}
1197
1198impl Sub<&UVec2> for &u32 {
1199 type Output = UVec2;
1200 #[inline]
1201 fn sub(self, rhs: &UVec2) -> UVec2 {
1202 (*self).sub(*rhs)
1203 }
1204}
1205
1206impl Sub<UVec2> for &u32 {
1207 type Output = UVec2;
1208 #[inline]
1209 fn sub(self, rhs: UVec2) -> UVec2 {
1210 (*self).sub(rhs)
1211 }
1212}
1213
1214impl Rem for UVec2 {
1215 type Output = Self;
1216 #[inline]
1217 fn rem(self, rhs: Self) -> Self {
1218 Self::new(self.x.rem(rhs.x), self.y.rem(rhs.y))
1219 }
1220}
1221
1222impl Rem<&Self> for UVec2 {
1223 type Output = Self;
1224 #[inline]
1225 fn rem(self, rhs: &Self) -> Self {
1226 self.rem(*rhs)
1227 }
1228}
1229
1230impl Rem<&UVec2> for &UVec2 {
1231 type Output = UVec2;
1232 #[inline]
1233 fn rem(self, rhs: &UVec2) -> UVec2 {
1234 (*self).rem(*rhs)
1235 }
1236}
1237
1238impl Rem<UVec2> for &UVec2 {
1239 type Output = UVec2;
1240 #[inline]
1241 fn rem(self, rhs: UVec2) -> UVec2 {
1242 (*self).rem(rhs)
1243 }
1244}
1245
1246impl RemAssign for UVec2 {
1247 #[inline]
1248 fn rem_assign(&mut self, rhs: Self) {
1249 self.x.rem_assign(rhs.x);
1250 self.y.rem_assign(rhs.y);
1251 }
1252}
1253
1254impl RemAssign<&Self> for UVec2 {
1255 #[inline]
1256 fn rem_assign(&mut self, rhs: &Self) {
1257 self.rem_assign(*rhs);
1258 }
1259}
1260
1261impl Rem<u32> for UVec2 {
1262 type Output = Self;
1263 #[inline]
1264 fn rem(self, rhs: u32) -> Self {
1265 Self::new(self.x.rem(rhs), self.y.rem(rhs))
1266 }
1267}
1268
1269impl Rem<&u32> for UVec2 {
1270 type Output = Self;
1271 #[inline]
1272 fn rem(self, rhs: &u32) -> Self {
1273 self.rem(*rhs)
1274 }
1275}
1276
1277impl Rem<&u32> for &UVec2 {
1278 type Output = UVec2;
1279 #[inline]
1280 fn rem(self, rhs: &u32) -> UVec2 {
1281 (*self).rem(*rhs)
1282 }
1283}
1284
1285impl Rem<u32> for &UVec2 {
1286 type Output = UVec2;
1287 #[inline]
1288 fn rem(self, rhs: u32) -> UVec2 {
1289 (*self).rem(rhs)
1290 }
1291}
1292
1293impl RemAssign<u32> for UVec2 {
1294 #[inline]
1295 fn rem_assign(&mut self, rhs: u32) {
1296 self.x.rem_assign(rhs);
1297 self.y.rem_assign(rhs);
1298 }
1299}
1300
1301impl RemAssign<&u32> for UVec2 {
1302 #[inline]
1303 fn rem_assign(&mut self, rhs: &u32) {
1304 self.rem_assign(*rhs);
1305 }
1306}
1307
1308impl Rem<UVec2> for u32 {
1309 type Output = UVec2;
1310 #[inline]
1311 fn rem(self, rhs: UVec2) -> UVec2 {
1312 UVec2::new(self.rem(rhs.x), self.rem(rhs.y))
1313 }
1314}
1315
1316impl Rem<&UVec2> for u32 {
1317 type Output = UVec2;
1318 #[inline]
1319 fn rem(self, rhs: &UVec2) -> UVec2 {
1320 self.rem(*rhs)
1321 }
1322}
1323
1324impl Rem<&UVec2> for &u32 {
1325 type Output = UVec2;
1326 #[inline]
1327 fn rem(self, rhs: &UVec2) -> UVec2 {
1328 (*self).rem(*rhs)
1329 }
1330}
1331
1332impl Rem<UVec2> for &u32 {
1333 type Output = UVec2;
1334 #[inline]
1335 fn rem(self, rhs: UVec2) -> UVec2 {
1336 (*self).rem(rhs)
1337 }
1338}
1339
1340impl AsRef<[u32; 2]> for UVec2 {
1341 #[inline]
1342 fn as_ref(&self) -> &[u32; 2] {
1343 unsafe { &*(self as *const Self as *const [u32; 2]) }
1344 }
1345}
1346
1347impl AsMut<[u32; 2]> for UVec2 {
1348 #[inline]
1349 fn as_mut(&mut self) -> &mut [u32; 2] {
1350 unsafe { &mut *(self as *mut Self as *mut [u32; 2]) }
1351 }
1352}
1353
1354impl Sum for UVec2 {
1355 #[inline]
1356 fn sum<I>(iter: I) -> Self
1357 where
1358 I: Iterator<Item = Self>,
1359 {
1360 iter.fold(Self::ZERO, Self::add)
1361 }
1362}
1363
1364impl<'a> Sum<&'a Self> for UVec2 {
1365 #[inline]
1366 fn sum<I>(iter: I) -> Self
1367 where
1368 I: Iterator<Item = &'a Self>,
1369 {
1370 iter.fold(Self::ZERO, |a, &b| Self::add(a, b))
1371 }
1372}
1373
1374impl Product for UVec2 {
1375 #[inline]
1376 fn product<I>(iter: I) -> Self
1377 where
1378 I: Iterator<Item = Self>,
1379 {
1380 iter.fold(Self::ONE, Self::mul)
1381 }
1382}
1383
1384impl<'a> Product<&'a Self> for UVec2 {
1385 #[inline]
1386 fn product<I>(iter: I) -> Self
1387 where
1388 I: Iterator<Item = &'a Self>,
1389 {
1390 iter.fold(Self::ONE, |a, &b| Self::mul(a, b))
1391 }
1392}
1393
1394impl Not for UVec2 {
1395 type Output = Self;
1396 #[inline]
1397 fn not(self) -> Self {
1398 Self::new(self.x.not(), self.y.not())
1399 }
1400}
1401
1402impl Not for &UVec2 {
1403 type Output = UVec2;
1404 #[inline]
1405 fn not(self) -> UVec2 {
1406 (*self).not()
1407 }
1408}
1409
1410impl BitAnd for UVec2 {
1411 type Output = Self;
1412 #[inline]
1413 fn bitand(self, rhs: Self) -> Self::Output {
1414 Self::new(self.x.bitand(rhs.x), self.y.bitand(rhs.y))
1415 }
1416}
1417
1418impl BitAnd<&Self> for UVec2 {
1419 type Output = Self;
1420 #[inline]
1421 fn bitand(self, rhs: &Self) -> Self {
1422 self.bitand(*rhs)
1423 }
1424}
1425
1426impl BitAnd<&UVec2> for &UVec2 {
1427 type Output = UVec2;
1428 #[inline]
1429 fn bitand(self, rhs: &UVec2) -> UVec2 {
1430 (*self).bitand(*rhs)
1431 }
1432}
1433
1434impl BitAnd<UVec2> for &UVec2 {
1435 type Output = UVec2;
1436 #[inline]
1437 fn bitand(self, rhs: UVec2) -> UVec2 {
1438 (*self).bitand(rhs)
1439 }
1440}
1441
1442impl BitAndAssign for UVec2 {
1443 #[inline]
1444 fn bitand_assign(&mut self, rhs: Self) {
1445 *self = self.bitand(rhs);
1446 }
1447}
1448
1449impl BitAndAssign<&Self> for UVec2 {
1450 #[inline]
1451 fn bitand_assign(&mut self, rhs: &Self) {
1452 self.bitand_assign(*rhs);
1453 }
1454}
1455
1456impl BitOr for UVec2 {
1457 type Output = Self;
1458 #[inline]
1459 fn bitor(self, rhs: Self) -> Self::Output {
1460 Self::new(self.x.bitor(rhs.x), self.y.bitor(rhs.y))
1461 }
1462}
1463
1464impl BitOr<&Self> for UVec2 {
1465 type Output = Self;
1466 #[inline]
1467 fn bitor(self, rhs: &Self) -> Self {
1468 self.bitor(*rhs)
1469 }
1470}
1471
1472impl BitOr<&UVec2> for &UVec2 {
1473 type Output = UVec2;
1474 #[inline]
1475 fn bitor(self, rhs: &UVec2) -> UVec2 {
1476 (*self).bitor(*rhs)
1477 }
1478}
1479
1480impl BitOr<UVec2> for &UVec2 {
1481 type Output = UVec2;
1482 #[inline]
1483 fn bitor(self, rhs: UVec2) -> UVec2 {
1484 (*self).bitor(rhs)
1485 }
1486}
1487
1488impl BitOrAssign for UVec2 {
1489 #[inline]
1490 fn bitor_assign(&mut self, rhs: Self) {
1491 *self = self.bitor(rhs);
1492 }
1493}
1494
1495impl BitOrAssign<&Self> for UVec2 {
1496 #[inline]
1497 fn bitor_assign(&mut self, rhs: &Self) {
1498 self.bitor_assign(*rhs);
1499 }
1500}
1501
1502impl BitXor for UVec2 {
1503 type Output = Self;
1504 #[inline]
1505 fn bitxor(self, rhs: Self) -> Self::Output {
1506 Self::new(self.x.bitxor(rhs.x), self.y.bitxor(rhs.y))
1507 }
1508}
1509
1510impl BitXor<&Self> for UVec2 {
1511 type Output = Self;
1512 #[inline]
1513 fn bitxor(self, rhs: &Self) -> Self {
1514 self.bitxor(*rhs)
1515 }
1516}
1517
1518impl BitXor<&UVec2> for &UVec2 {
1519 type Output = UVec2;
1520 #[inline]
1521 fn bitxor(self, rhs: &UVec2) -> UVec2 {
1522 (*self).bitxor(*rhs)
1523 }
1524}
1525
1526impl BitXor<UVec2> for &UVec2 {
1527 type Output = UVec2;
1528 #[inline]
1529 fn bitxor(self, rhs: UVec2) -> UVec2 {
1530 (*self).bitxor(rhs)
1531 }
1532}
1533
1534impl BitXorAssign for UVec2 {
1535 #[inline]
1536 fn bitxor_assign(&mut self, rhs: Self) {
1537 *self = self.bitxor(rhs);
1538 }
1539}
1540
1541impl BitXorAssign<&Self> for UVec2 {
1542 #[inline]
1543 fn bitxor_assign(&mut self, rhs: &Self) {
1544 self.bitxor_assign(*rhs);
1545 }
1546}
1547
1548impl BitAnd<u32> for UVec2 {
1549 type Output = Self;
1550 #[inline]
1551 fn bitand(self, rhs: u32) -> Self::Output {
1552 Self::new(self.x.bitand(rhs), self.y.bitand(rhs))
1553 }
1554}
1555
1556impl BitAnd<&u32> for UVec2 {
1557 type Output = Self;
1558 #[inline]
1559 fn bitand(self, rhs: &u32) -> Self {
1560 self.bitand(*rhs)
1561 }
1562}
1563
1564impl BitAnd<&u32> for &UVec2 {
1565 type Output = UVec2;
1566 #[inline]
1567 fn bitand(self, rhs: &u32) -> UVec2 {
1568 (*self).bitand(*rhs)
1569 }
1570}
1571
1572impl BitAnd<u32> for &UVec2 {
1573 type Output = UVec2;
1574 #[inline]
1575 fn bitand(self, rhs: u32) -> UVec2 {
1576 (*self).bitand(rhs)
1577 }
1578}
1579
1580impl BitAndAssign<u32> for UVec2 {
1581 #[inline]
1582 fn bitand_assign(&mut self, rhs: u32) {
1583 *self = self.bitand(rhs);
1584 }
1585}
1586
1587impl BitAndAssign<&u32> for UVec2 {
1588 #[inline]
1589 fn bitand_assign(&mut self, rhs: &u32) {
1590 self.bitand_assign(*rhs);
1591 }
1592}
1593
1594impl BitOr<u32> for UVec2 {
1595 type Output = Self;
1596 #[inline]
1597 fn bitor(self, rhs: u32) -> Self::Output {
1598 Self::new(self.x.bitor(rhs), self.y.bitor(rhs))
1599 }
1600}
1601
1602impl BitOr<&u32> for UVec2 {
1603 type Output = Self;
1604 #[inline]
1605 fn bitor(self, rhs: &u32) -> Self {
1606 self.bitor(*rhs)
1607 }
1608}
1609
1610impl BitOr<&u32> for &UVec2 {
1611 type Output = UVec2;
1612 #[inline]
1613 fn bitor(self, rhs: &u32) -> UVec2 {
1614 (*self).bitor(*rhs)
1615 }
1616}
1617
1618impl BitOr<u32> for &UVec2 {
1619 type Output = UVec2;
1620 #[inline]
1621 fn bitor(self, rhs: u32) -> UVec2 {
1622 (*self).bitor(rhs)
1623 }
1624}
1625
1626impl BitOrAssign<u32> for UVec2 {
1627 #[inline]
1628 fn bitor_assign(&mut self, rhs: u32) {
1629 *self = self.bitor(rhs);
1630 }
1631}
1632
1633impl BitOrAssign<&u32> for UVec2 {
1634 #[inline]
1635 fn bitor_assign(&mut self, rhs: &u32) {
1636 self.bitor_assign(*rhs);
1637 }
1638}
1639
1640impl BitXor<u32> for UVec2 {
1641 type Output = Self;
1642 #[inline]
1643 fn bitxor(self, rhs: u32) -> Self::Output {
1644 Self::new(self.x.bitxor(rhs), self.y.bitxor(rhs))
1645 }
1646}
1647
1648impl BitXor<&u32> for UVec2 {
1649 type Output = Self;
1650 #[inline]
1651 fn bitxor(self, rhs: &u32) -> Self {
1652 self.bitxor(*rhs)
1653 }
1654}
1655
1656impl BitXor<&u32> for &UVec2 {
1657 type Output = UVec2;
1658 #[inline]
1659 fn bitxor(self, rhs: &u32) -> UVec2 {
1660 (*self).bitxor(*rhs)
1661 }
1662}
1663
1664impl BitXor<u32> for &UVec2 {
1665 type Output = UVec2;
1666 #[inline]
1667 fn bitxor(self, rhs: u32) -> UVec2 {
1668 (*self).bitxor(rhs)
1669 }
1670}
1671
1672impl BitXorAssign<u32> for UVec2 {
1673 #[inline]
1674 fn bitxor_assign(&mut self, rhs: u32) {
1675 *self = self.bitxor(rhs);
1676 }
1677}
1678
1679impl BitXorAssign<&u32> for UVec2 {
1680 #[inline]
1681 fn bitxor_assign(&mut self, rhs: &u32) {
1682 self.bitxor_assign(*rhs);
1683 }
1684}
1685
1686impl Shl<i8> for UVec2 {
1687 type Output = Self;
1688 #[inline]
1689 fn shl(self, rhs: i8) -> Self::Output {
1690 Self::new(self.x.shl(rhs), self.y.shl(rhs))
1691 }
1692}
1693
1694impl Shl<&i8> for UVec2 {
1695 type Output = Self;
1696 #[inline]
1697 fn shl(self, rhs: &i8) -> Self {
1698 self.shl(*rhs)
1699 }
1700}
1701
1702impl Shl<&i8> for &UVec2 {
1703 type Output = UVec2;
1704 #[inline]
1705 fn shl(self, rhs: &i8) -> UVec2 {
1706 (*self).shl(*rhs)
1707 }
1708}
1709
1710impl Shl<i8> for &UVec2 {
1711 type Output = UVec2;
1712 #[inline]
1713 fn shl(self, rhs: i8) -> UVec2 {
1714 (*self).shl(rhs)
1715 }
1716}
1717
1718impl ShlAssign<i8> for UVec2 {
1719 #[inline]
1720 fn shl_assign(&mut self, rhs: i8) {
1721 *self = self.shl(rhs);
1722 }
1723}
1724
1725impl ShlAssign<&i8> for UVec2 {
1726 #[inline]
1727 fn shl_assign(&mut self, rhs: &i8) {
1728 self.shl_assign(*rhs);
1729 }
1730}
1731
1732impl Shr<i8> for UVec2 {
1733 type Output = Self;
1734 #[inline]
1735 fn shr(self, rhs: i8) -> Self::Output {
1736 Self::new(self.x.shr(rhs), self.y.shr(rhs))
1737 }
1738}
1739
1740impl Shr<&i8> for UVec2 {
1741 type Output = Self;
1742 #[inline]
1743 fn shr(self, rhs: &i8) -> Self {
1744 self.shr(*rhs)
1745 }
1746}
1747
1748impl Shr<&i8> for &UVec2 {
1749 type Output = UVec2;
1750 #[inline]
1751 fn shr(self, rhs: &i8) -> UVec2 {
1752 (*self).shr(*rhs)
1753 }
1754}
1755
1756impl Shr<i8> for &UVec2 {
1757 type Output = UVec2;
1758 #[inline]
1759 fn shr(self, rhs: i8) -> UVec2 {
1760 (*self).shr(rhs)
1761 }
1762}
1763
1764impl ShrAssign<i8> for UVec2 {
1765 #[inline]
1766 fn shr_assign(&mut self, rhs: i8) {
1767 *self = self.shr(rhs);
1768 }
1769}
1770
1771impl ShrAssign<&i8> for UVec2 {
1772 #[inline]
1773 fn shr_assign(&mut self, rhs: &i8) {
1774 self.shr_assign(*rhs);
1775 }
1776}
1777
1778impl Shl<i16> for UVec2 {
1779 type Output = Self;
1780 #[inline]
1781 fn shl(self, rhs: i16) -> Self::Output {
1782 Self::new(self.x.shl(rhs), self.y.shl(rhs))
1783 }
1784}
1785
1786impl Shl<&i16> for UVec2 {
1787 type Output = Self;
1788 #[inline]
1789 fn shl(self, rhs: &i16) -> Self {
1790 self.shl(*rhs)
1791 }
1792}
1793
1794impl Shl<&i16> for &UVec2 {
1795 type Output = UVec2;
1796 #[inline]
1797 fn shl(self, rhs: &i16) -> UVec2 {
1798 (*self).shl(*rhs)
1799 }
1800}
1801
1802impl Shl<i16> for &UVec2 {
1803 type Output = UVec2;
1804 #[inline]
1805 fn shl(self, rhs: i16) -> UVec2 {
1806 (*self).shl(rhs)
1807 }
1808}
1809
1810impl ShlAssign<i16> for UVec2 {
1811 #[inline]
1812 fn shl_assign(&mut self, rhs: i16) {
1813 *self = self.shl(rhs);
1814 }
1815}
1816
1817impl ShlAssign<&i16> for UVec2 {
1818 #[inline]
1819 fn shl_assign(&mut self, rhs: &i16) {
1820 self.shl_assign(*rhs);
1821 }
1822}
1823
1824impl Shr<i16> for UVec2 {
1825 type Output = Self;
1826 #[inline]
1827 fn shr(self, rhs: i16) -> Self::Output {
1828 Self::new(self.x.shr(rhs), self.y.shr(rhs))
1829 }
1830}
1831
1832impl Shr<&i16> for UVec2 {
1833 type Output = Self;
1834 #[inline]
1835 fn shr(self, rhs: &i16) -> Self {
1836 self.shr(*rhs)
1837 }
1838}
1839
1840impl Shr<&i16> for &UVec2 {
1841 type Output = UVec2;
1842 #[inline]
1843 fn shr(self, rhs: &i16) -> UVec2 {
1844 (*self).shr(*rhs)
1845 }
1846}
1847
1848impl Shr<i16> for &UVec2 {
1849 type Output = UVec2;
1850 #[inline]
1851 fn shr(self, rhs: i16) -> UVec2 {
1852 (*self).shr(rhs)
1853 }
1854}
1855
1856impl ShrAssign<i16> for UVec2 {
1857 #[inline]
1858 fn shr_assign(&mut self, rhs: i16) {
1859 *self = self.shr(rhs);
1860 }
1861}
1862
1863impl ShrAssign<&i16> for UVec2 {
1864 #[inline]
1865 fn shr_assign(&mut self, rhs: &i16) {
1866 self.shr_assign(*rhs);
1867 }
1868}
1869
1870impl Shl<i32> for UVec2 {
1871 type Output = Self;
1872 #[inline]
1873 fn shl(self, rhs: i32) -> Self::Output {
1874 Self::new(self.x.shl(rhs), self.y.shl(rhs))
1875 }
1876}
1877
1878impl Shl<&i32> for UVec2 {
1879 type Output = Self;
1880 #[inline]
1881 fn shl(self, rhs: &i32) -> Self {
1882 self.shl(*rhs)
1883 }
1884}
1885
1886impl Shl<&i32> for &UVec2 {
1887 type Output = UVec2;
1888 #[inline]
1889 fn shl(self, rhs: &i32) -> UVec2 {
1890 (*self).shl(*rhs)
1891 }
1892}
1893
1894impl Shl<i32> for &UVec2 {
1895 type Output = UVec2;
1896 #[inline]
1897 fn shl(self, rhs: i32) -> UVec2 {
1898 (*self).shl(rhs)
1899 }
1900}
1901
1902impl ShlAssign<i32> for UVec2 {
1903 #[inline]
1904 fn shl_assign(&mut self, rhs: i32) {
1905 *self = self.shl(rhs);
1906 }
1907}
1908
1909impl ShlAssign<&i32> for UVec2 {
1910 #[inline]
1911 fn shl_assign(&mut self, rhs: &i32) {
1912 self.shl_assign(*rhs);
1913 }
1914}
1915
1916impl Shr<i32> for UVec2 {
1917 type Output = Self;
1918 #[inline]
1919 fn shr(self, rhs: i32) -> Self::Output {
1920 Self::new(self.x.shr(rhs), self.y.shr(rhs))
1921 }
1922}
1923
1924impl Shr<&i32> for UVec2 {
1925 type Output = Self;
1926 #[inline]
1927 fn shr(self, rhs: &i32) -> Self {
1928 self.shr(*rhs)
1929 }
1930}
1931
1932impl Shr<&i32> for &UVec2 {
1933 type Output = UVec2;
1934 #[inline]
1935 fn shr(self, rhs: &i32) -> UVec2 {
1936 (*self).shr(*rhs)
1937 }
1938}
1939
1940impl Shr<i32> for &UVec2 {
1941 type Output = UVec2;
1942 #[inline]
1943 fn shr(self, rhs: i32) -> UVec2 {
1944 (*self).shr(rhs)
1945 }
1946}
1947
1948impl ShrAssign<i32> for UVec2 {
1949 #[inline]
1950 fn shr_assign(&mut self, rhs: i32) {
1951 *self = self.shr(rhs);
1952 }
1953}
1954
1955impl ShrAssign<&i32> for UVec2 {
1956 #[inline]
1957 fn shr_assign(&mut self, rhs: &i32) {
1958 self.shr_assign(*rhs);
1959 }
1960}
1961
1962impl Shl<i64> for UVec2 {
1963 type Output = Self;
1964 #[inline]
1965 fn shl(self, rhs: i64) -> Self::Output {
1966 Self::new(self.x.shl(rhs), self.y.shl(rhs))
1967 }
1968}
1969
1970impl Shl<&i64> for UVec2 {
1971 type Output = Self;
1972 #[inline]
1973 fn shl(self, rhs: &i64) -> Self {
1974 self.shl(*rhs)
1975 }
1976}
1977
1978impl Shl<&i64> for &UVec2 {
1979 type Output = UVec2;
1980 #[inline]
1981 fn shl(self, rhs: &i64) -> UVec2 {
1982 (*self).shl(*rhs)
1983 }
1984}
1985
1986impl Shl<i64> for &UVec2 {
1987 type Output = UVec2;
1988 #[inline]
1989 fn shl(self, rhs: i64) -> UVec2 {
1990 (*self).shl(rhs)
1991 }
1992}
1993
1994impl ShlAssign<i64> for UVec2 {
1995 #[inline]
1996 fn shl_assign(&mut self, rhs: i64) {
1997 *self = self.shl(rhs);
1998 }
1999}
2000
2001impl ShlAssign<&i64> for UVec2 {
2002 #[inline]
2003 fn shl_assign(&mut self, rhs: &i64) {
2004 self.shl_assign(*rhs);
2005 }
2006}
2007
2008impl Shr<i64> for UVec2 {
2009 type Output = Self;
2010 #[inline]
2011 fn shr(self, rhs: i64) -> Self::Output {
2012 Self::new(self.x.shr(rhs), self.y.shr(rhs))
2013 }
2014}
2015
2016impl Shr<&i64> for UVec2 {
2017 type Output = Self;
2018 #[inline]
2019 fn shr(self, rhs: &i64) -> Self {
2020 self.shr(*rhs)
2021 }
2022}
2023
2024impl Shr<&i64> for &UVec2 {
2025 type Output = UVec2;
2026 #[inline]
2027 fn shr(self, rhs: &i64) -> UVec2 {
2028 (*self).shr(*rhs)
2029 }
2030}
2031
2032impl Shr<i64> for &UVec2 {
2033 type Output = UVec2;
2034 #[inline]
2035 fn shr(self, rhs: i64) -> UVec2 {
2036 (*self).shr(rhs)
2037 }
2038}
2039
2040impl ShrAssign<i64> for UVec2 {
2041 #[inline]
2042 fn shr_assign(&mut self, rhs: i64) {
2043 *self = self.shr(rhs);
2044 }
2045}
2046
2047impl ShrAssign<&i64> for UVec2 {
2048 #[inline]
2049 fn shr_assign(&mut self, rhs: &i64) {
2050 self.shr_assign(*rhs);
2051 }
2052}
2053
2054impl Shl<u8> for UVec2 {
2055 type Output = Self;
2056 #[inline]
2057 fn shl(self, rhs: u8) -> Self::Output {
2058 Self::new(self.x.shl(rhs), self.y.shl(rhs))
2059 }
2060}
2061
2062impl Shl<&u8> for UVec2 {
2063 type Output = Self;
2064 #[inline]
2065 fn shl(self, rhs: &u8) -> Self {
2066 self.shl(*rhs)
2067 }
2068}
2069
2070impl Shl<&u8> for &UVec2 {
2071 type Output = UVec2;
2072 #[inline]
2073 fn shl(self, rhs: &u8) -> UVec2 {
2074 (*self).shl(*rhs)
2075 }
2076}
2077
2078impl Shl<u8> for &UVec2 {
2079 type Output = UVec2;
2080 #[inline]
2081 fn shl(self, rhs: u8) -> UVec2 {
2082 (*self).shl(rhs)
2083 }
2084}
2085
2086impl ShlAssign<u8> for UVec2 {
2087 #[inline]
2088 fn shl_assign(&mut self, rhs: u8) {
2089 *self = self.shl(rhs);
2090 }
2091}
2092
2093impl ShlAssign<&u8> for UVec2 {
2094 #[inline]
2095 fn shl_assign(&mut self, rhs: &u8) {
2096 self.shl_assign(*rhs);
2097 }
2098}
2099
2100impl Shr<u8> for UVec2 {
2101 type Output = Self;
2102 #[inline]
2103 fn shr(self, rhs: u8) -> Self::Output {
2104 Self::new(self.x.shr(rhs), self.y.shr(rhs))
2105 }
2106}
2107
2108impl Shr<&u8> for UVec2 {
2109 type Output = Self;
2110 #[inline]
2111 fn shr(self, rhs: &u8) -> Self {
2112 self.shr(*rhs)
2113 }
2114}
2115
2116impl Shr<&u8> for &UVec2 {
2117 type Output = UVec2;
2118 #[inline]
2119 fn shr(self, rhs: &u8) -> UVec2 {
2120 (*self).shr(*rhs)
2121 }
2122}
2123
2124impl Shr<u8> for &UVec2 {
2125 type Output = UVec2;
2126 #[inline]
2127 fn shr(self, rhs: u8) -> UVec2 {
2128 (*self).shr(rhs)
2129 }
2130}
2131
2132impl ShrAssign<u8> for UVec2 {
2133 #[inline]
2134 fn shr_assign(&mut self, rhs: u8) {
2135 *self = self.shr(rhs);
2136 }
2137}
2138
2139impl ShrAssign<&u8> for UVec2 {
2140 #[inline]
2141 fn shr_assign(&mut self, rhs: &u8) {
2142 self.shr_assign(*rhs);
2143 }
2144}
2145
2146impl Shl<u16> for UVec2 {
2147 type Output = Self;
2148 #[inline]
2149 fn shl(self, rhs: u16) -> Self::Output {
2150 Self::new(self.x.shl(rhs), self.y.shl(rhs))
2151 }
2152}
2153
2154impl Shl<&u16> for UVec2 {
2155 type Output = Self;
2156 #[inline]
2157 fn shl(self, rhs: &u16) -> Self {
2158 self.shl(*rhs)
2159 }
2160}
2161
2162impl Shl<&u16> for &UVec2 {
2163 type Output = UVec2;
2164 #[inline]
2165 fn shl(self, rhs: &u16) -> UVec2 {
2166 (*self).shl(*rhs)
2167 }
2168}
2169
2170impl Shl<u16> for &UVec2 {
2171 type Output = UVec2;
2172 #[inline]
2173 fn shl(self, rhs: u16) -> UVec2 {
2174 (*self).shl(rhs)
2175 }
2176}
2177
2178impl ShlAssign<u16> for UVec2 {
2179 #[inline]
2180 fn shl_assign(&mut self, rhs: u16) {
2181 *self = self.shl(rhs);
2182 }
2183}
2184
2185impl ShlAssign<&u16> for UVec2 {
2186 #[inline]
2187 fn shl_assign(&mut self, rhs: &u16) {
2188 self.shl_assign(*rhs);
2189 }
2190}
2191
2192impl Shr<u16> for UVec2 {
2193 type Output = Self;
2194 #[inline]
2195 fn shr(self, rhs: u16) -> Self::Output {
2196 Self::new(self.x.shr(rhs), self.y.shr(rhs))
2197 }
2198}
2199
2200impl Shr<&u16> for UVec2 {
2201 type Output = Self;
2202 #[inline]
2203 fn shr(self, rhs: &u16) -> Self {
2204 self.shr(*rhs)
2205 }
2206}
2207
2208impl Shr<&u16> for &UVec2 {
2209 type Output = UVec2;
2210 #[inline]
2211 fn shr(self, rhs: &u16) -> UVec2 {
2212 (*self).shr(*rhs)
2213 }
2214}
2215
2216impl Shr<u16> for &UVec2 {
2217 type Output = UVec2;
2218 #[inline]
2219 fn shr(self, rhs: u16) -> UVec2 {
2220 (*self).shr(rhs)
2221 }
2222}
2223
2224impl ShrAssign<u16> for UVec2 {
2225 #[inline]
2226 fn shr_assign(&mut self, rhs: u16) {
2227 *self = self.shr(rhs);
2228 }
2229}
2230
2231impl ShrAssign<&u16> for UVec2 {
2232 #[inline]
2233 fn shr_assign(&mut self, rhs: &u16) {
2234 self.shr_assign(*rhs);
2235 }
2236}
2237
2238impl Shl<u32> for UVec2 {
2239 type Output = Self;
2240 #[inline]
2241 fn shl(self, rhs: u32) -> Self::Output {
2242 Self::new(self.x.shl(rhs), self.y.shl(rhs))
2243 }
2244}
2245
2246impl Shl<&u32> for UVec2 {
2247 type Output = Self;
2248 #[inline]
2249 fn shl(self, rhs: &u32) -> Self {
2250 self.shl(*rhs)
2251 }
2252}
2253
2254impl Shl<&u32> for &UVec2 {
2255 type Output = UVec2;
2256 #[inline]
2257 fn shl(self, rhs: &u32) -> UVec2 {
2258 (*self).shl(*rhs)
2259 }
2260}
2261
2262impl Shl<u32> for &UVec2 {
2263 type Output = UVec2;
2264 #[inline]
2265 fn shl(self, rhs: u32) -> UVec2 {
2266 (*self).shl(rhs)
2267 }
2268}
2269
2270impl ShlAssign<u32> for UVec2 {
2271 #[inline]
2272 fn shl_assign(&mut self, rhs: u32) {
2273 *self = self.shl(rhs);
2274 }
2275}
2276
2277impl ShlAssign<&u32> for UVec2 {
2278 #[inline]
2279 fn shl_assign(&mut self, rhs: &u32) {
2280 self.shl_assign(*rhs);
2281 }
2282}
2283
2284impl Shr<u32> for UVec2 {
2285 type Output = Self;
2286 #[inline]
2287 fn shr(self, rhs: u32) -> Self::Output {
2288 Self::new(self.x.shr(rhs), self.y.shr(rhs))
2289 }
2290}
2291
2292impl Shr<&u32> for UVec2 {
2293 type Output = Self;
2294 #[inline]
2295 fn shr(self, rhs: &u32) -> Self {
2296 self.shr(*rhs)
2297 }
2298}
2299
2300impl Shr<&u32> for &UVec2 {
2301 type Output = UVec2;
2302 #[inline]
2303 fn shr(self, rhs: &u32) -> UVec2 {
2304 (*self).shr(*rhs)
2305 }
2306}
2307
2308impl Shr<u32> for &UVec2 {
2309 type Output = UVec2;
2310 #[inline]
2311 fn shr(self, rhs: u32) -> UVec2 {
2312 (*self).shr(rhs)
2313 }
2314}
2315
2316impl ShrAssign<u32> for UVec2 {
2317 #[inline]
2318 fn shr_assign(&mut self, rhs: u32) {
2319 *self = self.shr(rhs);
2320 }
2321}
2322
2323impl ShrAssign<&u32> for UVec2 {
2324 #[inline]
2325 fn shr_assign(&mut self, rhs: &u32) {
2326 self.shr_assign(*rhs);
2327 }
2328}
2329
2330impl Shl<u64> for UVec2 {
2331 type Output = Self;
2332 #[inline]
2333 fn shl(self, rhs: u64) -> Self::Output {
2334 Self::new(self.x.shl(rhs), self.y.shl(rhs))
2335 }
2336}
2337
2338impl Shl<&u64> for UVec2 {
2339 type Output = Self;
2340 #[inline]
2341 fn shl(self, rhs: &u64) -> Self {
2342 self.shl(*rhs)
2343 }
2344}
2345
2346impl Shl<&u64> for &UVec2 {
2347 type Output = UVec2;
2348 #[inline]
2349 fn shl(self, rhs: &u64) -> UVec2 {
2350 (*self).shl(*rhs)
2351 }
2352}
2353
2354impl Shl<u64> for &UVec2 {
2355 type Output = UVec2;
2356 #[inline]
2357 fn shl(self, rhs: u64) -> UVec2 {
2358 (*self).shl(rhs)
2359 }
2360}
2361
2362impl ShlAssign<u64> for UVec2 {
2363 #[inline]
2364 fn shl_assign(&mut self, rhs: u64) {
2365 *self = self.shl(rhs);
2366 }
2367}
2368
2369impl ShlAssign<&u64> for UVec2 {
2370 #[inline]
2371 fn shl_assign(&mut self, rhs: &u64) {
2372 self.shl_assign(*rhs);
2373 }
2374}
2375
2376impl Shr<u64> for UVec2 {
2377 type Output = Self;
2378 #[inline]
2379 fn shr(self, rhs: u64) -> Self::Output {
2380 Self::new(self.x.shr(rhs), self.y.shr(rhs))
2381 }
2382}
2383
2384impl Shr<&u64> for UVec2 {
2385 type Output = Self;
2386 #[inline]
2387 fn shr(self, rhs: &u64) -> Self {
2388 self.shr(*rhs)
2389 }
2390}
2391
2392impl Shr<&u64> for &UVec2 {
2393 type Output = UVec2;
2394 #[inline]
2395 fn shr(self, rhs: &u64) -> UVec2 {
2396 (*self).shr(*rhs)
2397 }
2398}
2399
2400impl Shr<u64> for &UVec2 {
2401 type Output = UVec2;
2402 #[inline]
2403 fn shr(self, rhs: u64) -> UVec2 {
2404 (*self).shr(rhs)
2405 }
2406}
2407
2408impl ShrAssign<u64> for UVec2 {
2409 #[inline]
2410 fn shr_assign(&mut self, rhs: u64) {
2411 *self = self.shr(rhs);
2412 }
2413}
2414
2415impl ShrAssign<&u64> for UVec2 {
2416 #[inline]
2417 fn shr_assign(&mut self, rhs: &u64) {
2418 self.shr_assign(*rhs);
2419 }
2420}
2421
2422#[cfg(feature = "i32")]
2423impl Shl<IVec2> for UVec2 {
2424 type Output = Self;
2425 #[inline]
2426 fn shl(self, rhs: IVec2) -> Self {
2427 Self::new(self.x.shl(rhs.x), self.y.shl(rhs.y))
2428 }
2429}
2430
2431#[cfg(feature = "i32")]
2432impl Shl<&IVec2> for UVec2 {
2433 type Output = Self;
2434 #[inline]
2435 fn shl(self, rhs: &IVec2) -> Self {
2436 self.shl(*rhs)
2437 }
2438}
2439
2440#[cfg(feature = "i32")]
2441impl Shl<&IVec2> for &UVec2 {
2442 type Output = UVec2;
2443 #[inline]
2444 fn shl(self, rhs: &IVec2) -> UVec2 {
2445 (*self).shl(*rhs)
2446 }
2447}
2448
2449#[cfg(feature = "i32")]
2450impl Shl<IVec2> for &UVec2 {
2451 type Output = UVec2;
2452 #[inline]
2453 fn shl(self, rhs: IVec2) -> UVec2 {
2454 (*self).shl(rhs)
2455 }
2456}
2457
2458#[cfg(feature = "i32")]
2459impl Shr<IVec2> for UVec2 {
2460 type Output = Self;
2461 #[inline]
2462 fn shr(self, rhs: IVec2) -> Self {
2463 Self::new(self.x.shr(rhs.x), self.y.shr(rhs.y))
2464 }
2465}
2466
2467#[cfg(feature = "i32")]
2468impl Shr<&IVec2> for UVec2 {
2469 type Output = Self;
2470 #[inline]
2471 fn shr(self, rhs: &IVec2) -> Self {
2472 self.shr(*rhs)
2473 }
2474}
2475
2476#[cfg(feature = "i32")]
2477impl Shr<&IVec2> for &UVec2 {
2478 type Output = UVec2;
2479 #[inline]
2480 fn shr(self, rhs: &IVec2) -> UVec2 {
2481 (*self).shr(*rhs)
2482 }
2483}
2484
2485#[cfg(feature = "i32")]
2486impl Shr<IVec2> for &UVec2 {
2487 type Output = UVec2;
2488 #[inline]
2489 fn shr(self, rhs: IVec2) -> UVec2 {
2490 (*self).shr(rhs)
2491 }
2492}
2493
2494impl Shl for UVec2 {
2495 type Output = Self;
2496 #[inline]
2497 fn shl(self, rhs: Self) -> Self {
2498 Self::new(self.x.shl(rhs.x), self.y.shl(rhs.y))
2499 }
2500}
2501
2502impl Shl<&Self> for UVec2 {
2503 type Output = Self;
2504 #[inline]
2505 fn shl(self, rhs: &Self) -> Self {
2506 self.shl(*rhs)
2507 }
2508}
2509
2510impl Shl<&UVec2> for &UVec2 {
2511 type Output = UVec2;
2512 #[inline]
2513 fn shl(self, rhs: &UVec2) -> UVec2 {
2514 (*self).shl(*rhs)
2515 }
2516}
2517
2518impl Shl<UVec2> for &UVec2 {
2519 type Output = UVec2;
2520 #[inline]
2521 fn shl(self, rhs: UVec2) -> UVec2 {
2522 (*self).shl(rhs)
2523 }
2524}
2525
2526impl Shr for UVec2 {
2527 type Output = Self;
2528 #[inline]
2529 fn shr(self, rhs: Self) -> Self {
2530 Self::new(self.x.shr(rhs.x), self.y.shr(rhs.y))
2531 }
2532}
2533
2534impl Shr<&Self> for UVec2 {
2535 type Output = Self;
2536 #[inline]
2537 fn shr(self, rhs: &Self) -> Self {
2538 self.shr(*rhs)
2539 }
2540}
2541
2542impl Shr<&UVec2> for &UVec2 {
2543 type Output = UVec2;
2544 #[inline]
2545 fn shr(self, rhs: &UVec2) -> UVec2 {
2546 (*self).shr(*rhs)
2547 }
2548}
2549
2550impl Shr<UVec2> for &UVec2 {
2551 type Output = UVec2;
2552 #[inline]
2553 fn shr(self, rhs: UVec2) -> UVec2 {
2554 (*self).shr(rhs)
2555 }
2556}
2557
2558impl Index<usize> for UVec2 {
2559 type Output = u32;
2560 #[inline]
2561 #[track_caller]
2562 fn index(&self, index: usize) -> &Self::Output {
2563 match index {
2564 0 => &self.x,
2565 1 => &self.y,
2566 _ => panic!("index out of bounds"),
2567 }
2568 }
2569}
2570
2571impl IndexMut<usize> for UVec2 {
2572 #[inline]
2573 #[track_caller]
2574 fn index_mut(&mut self, index: usize) -> &mut Self::Output {
2575 match index {
2576 0 => &mut self.x,
2577 1 => &mut self.y,
2578 _ => panic!("index out of bounds"),
2579 }
2580 }
2581}
2582
2583impl fmt::Display for UVec2 {
2584 fn fmt(&self, f: &mut fmt::Formatter<'_>) -> fmt::Result {
2585 write!(f, "[{}, {}]", self.x, self.y)
2586 }
2587}
2588
2589impl fmt::Debug for UVec2 {
2590 fn fmt(&self, fmt: &mut fmt::Formatter<'_>) -> fmt::Result {
2591 fmt.debug_tuple(stringify!(UVec2))
2592 .field(&self.x)
2593 .field(&self.y)
2594 .finish()
2595 }
2596}
2597
2598impl From<[u32; 2]> for UVec2 {
2599 #[inline]
2600 fn from(a: [u32; 2]) -> Self {
2601 Self::new(a[0], a[1])
2602 }
2603}
2604
2605impl From<UVec2> for [u32; 2] {
2606 #[inline]
2607 fn from(v: UVec2) -> Self {
2608 [v.x, v.y]
2609 }
2610}
2611
2612impl From<(u32, u32)> for UVec2 {
2613 #[inline]
2614 fn from(t: (u32, u32)) -> Self {
2615 Self::new(t.0, t.1)
2616 }
2617}
2618
2619impl From<UVec2> for (u32, u32) {
2620 #[inline]
2621 fn from(v: UVec2) -> Self {
2622 (v.x, v.y)
2623 }
2624}
2625
2626#[cfg(feature = "u8")]
2627impl From<U8Vec2> for UVec2 {
2628 #[inline]
2629 fn from(v: U8Vec2) -> Self {
2630 Self::new(u32::from(v.x), u32::from(v.y))
2631 }
2632}
2633
2634#[cfg(feature = "u16")]
2635impl From<U16Vec2> for UVec2 {
2636 #[inline]
2637 fn from(v: U16Vec2) -> Self {
2638 Self::new(u32::from(v.x), u32::from(v.y))
2639 }
2640}
2641
2642#[cfg(feature = "i8")]
2643impl TryFrom<I8Vec2> for UVec2 {
2644 type Error = core::num::TryFromIntError;
2645
2646 #[inline]
2647 fn try_from(v: I8Vec2) -> Result<Self, Self::Error> {
2648 Ok(Self::new(u32::try_from(v.x)?, u32::try_from(v.y)?))
2649 }
2650}
2651
2652#[cfg(feature = "i16")]
2653impl TryFrom<I16Vec2> for UVec2 {
2654 type Error = core::num::TryFromIntError;
2655
2656 #[inline]
2657 fn try_from(v: I16Vec2) -> Result<Self, Self::Error> {
2658 Ok(Self::new(u32::try_from(v.x)?, u32::try_from(v.y)?))
2659 }
2660}
2661
2662#[cfg(feature = "i32")]
2663impl TryFrom<IVec2> for UVec2 {
2664 type Error = core::num::TryFromIntError;
2665
2666 #[inline]
2667 fn try_from(v: IVec2) -> Result<Self, Self::Error> {
2668 Ok(Self::new(u32::try_from(v.x)?, u32::try_from(v.y)?))
2669 }
2670}
2671
2672#[cfg(feature = "i64")]
2673impl TryFrom<I64Vec2> for UVec2 {
2674 type Error = core::num::TryFromIntError;
2675
2676 #[inline]
2677 fn try_from(v: I64Vec2) -> Result<Self, Self::Error> {
2678 Ok(Self::new(u32::try_from(v.x)?, u32::try_from(v.y)?))
2679 }
2680}
2681
2682#[cfg(feature = "u64")]
2683impl TryFrom<U64Vec2> for UVec2 {
2684 type Error = core::num::TryFromIntError;
2685
2686 #[inline]
2687 fn try_from(v: U64Vec2) -> Result<Self, Self::Error> {
2688 Ok(Self::new(u32::try_from(v.x)?, u32::try_from(v.y)?))
2689 }
2690}
2691
2692#[cfg(feature = "isize")]
2693impl TryFrom<ISizeVec2> for UVec2 {
2694 type Error = core::num::TryFromIntError;
2695
2696 #[inline]
2697 fn try_from(v: ISizeVec2) -> Result<Self, Self::Error> {
2698 Ok(Self::new(u32::try_from(v.x)?, u32::try_from(v.y)?))
2699 }
2700}
2701
2702#[cfg(feature = "usize")]
2703impl TryFrom<USizeVec2> for UVec2 {
2704 type Error = core::num::TryFromIntError;
2705
2706 #[inline]
2707 fn try_from(v: USizeVec2) -> Result<Self, Self::Error> {
2708 Ok(Self::new(u32::try_from(v.x)?, u32::try_from(v.y)?))
2709 }
2710}
2711
2712impl From<BVec2> for UVec2 {
2713 #[inline]
2714 fn from(v: BVec2) -> Self {
2715 Self::new(u32::from(v.x), u32::from(v.y))
2716 }
2717}