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