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