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