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