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