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