glam/u32/
uvec3.rs

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