• Home
  • Line#
  • Scopes#
  • Navigate#
  • Raw
  • Download
1 // Generated from vec.rs.tera template. Edit the template, not the generated file.
2 
3 use crate::{
4     BVec3, BVec3A, I16Vec3, I64Vec2, I64Vec4, I8Vec3, IVec3, U16Vec3, U64Vec3, U8Vec3, UVec3,
5 };
6 
7 use core::fmt;
8 use core::iter::{Product, Sum};
9 use core::{f32, ops::*};
10 
11 /// Creates a 3-dimensional vector.
12 #[inline(always)]
13 #[must_use]
i64vec3(x: i64, y: i64, z: i64) -> I64Vec314 pub const fn i64vec3(x: i64, y: i64, z: i64) -> I64Vec3 {
15     I64Vec3::new(x, y, z)
16 }
17 
18 /// A 3-dimensional vector.
19 #[cfg_attr(not(target_arch = "spirv"), derive(Hash))]
20 #[derive(Clone, Copy, PartialEq, Eq)]
21 #[cfg_attr(not(target_arch = "spirv"), repr(C))]
22 #[cfg_attr(target_arch = "spirv", repr(simd))]
23 pub struct I64Vec3 {
24     pub x: i64,
25     pub y: i64,
26     pub z: i64,
27 }
28 
29 impl I64Vec3 {
30     /// All zeroes.
31     pub const ZERO: Self = Self::splat(0);
32 
33     /// All ones.
34     pub const ONE: Self = Self::splat(1);
35 
36     /// All negative ones.
37     pub const NEG_ONE: Self = Self::splat(-1);
38 
39     /// All `i64::MIN`.
40     pub const MIN: Self = Self::splat(i64::MIN);
41 
42     /// All `i64::MAX`.
43     pub const MAX: Self = Self::splat(i64::MAX);
44 
45     /// A unit vector pointing along the positive X axis.
46     pub const X: Self = Self::new(1, 0, 0);
47 
48     /// A unit vector pointing along the positive Y axis.
49     pub const Y: Self = Self::new(0, 1, 0);
50 
51     /// A unit vector pointing along the positive Z axis.
52     pub const Z: Self = Self::new(0, 0, 1);
53 
54     /// A unit vector pointing along the negative X axis.
55     pub const NEG_X: Self = Self::new(-1, 0, 0);
56 
57     /// A unit vector pointing along the negative Y axis.
58     pub const NEG_Y: Self = Self::new(0, -1, 0);
59 
60     /// A unit vector pointing along the negative Z axis.
61     pub const NEG_Z: Self = Self::new(0, 0, -1);
62 
63     /// The unit axes.
64     pub const AXES: [Self; 3] = [Self::X, Self::Y, Self::Z];
65 
66     /// Creates a new vector.
67     #[inline(always)]
68     #[must_use]
new(x: i64, y: i64, z: i64) -> Self69     pub const fn new(x: i64, y: i64, z: i64) -> Self {
70         Self { x, y, z }
71     }
72 
73     /// Creates a vector with all elements set to `v`.
74     #[inline]
75     #[must_use]
splat(v: i64) -> Self76     pub const fn splat(v: i64) -> Self {
77         Self { x: v, y: v, z: v }
78     }
79 
80     /// Returns a vector containing each element of `self` modified by a mapping function `f`.
81     #[inline]
82     #[must_use]
map<F>(self, f: F) -> Self where F: Fn(i64) -> i64,83     pub fn map<F>(self, f: F) -> Self
84     where
85         F: Fn(i64) -> i64,
86     {
87         Self::new(f(self.x), f(self.y), f(self.z))
88     }
89 
90     /// Creates a vector from the elements in `if_true` and `if_false`, selecting which to use
91     /// for each element of `self`.
92     ///
93     /// A true element in the mask uses the corresponding element from `if_true`, and false
94     /// uses the element from `if_false`.
95     #[inline]
96     #[must_use]
select(mask: BVec3, if_true: Self, if_false: Self) -> Self97     pub fn select(mask: BVec3, if_true: Self, if_false: Self) -> Self {
98         Self {
99             x: if mask.test(0) { if_true.x } else { if_false.x },
100             y: if mask.test(1) { if_true.y } else { if_false.y },
101             z: if mask.test(2) { if_true.z } else { if_false.z },
102         }
103     }
104 
105     /// Creates a new vector from an array.
106     #[inline]
107     #[must_use]
from_array(a: [i64; 3]) -> Self108     pub const fn from_array(a: [i64; 3]) -> Self {
109         Self::new(a[0], a[1], a[2])
110     }
111 
112     /// `[x, y, z]`
113     #[inline]
114     #[must_use]
to_array(&self) -> [i64; 3]115     pub const fn to_array(&self) -> [i64; 3] {
116         [self.x, self.y, self.z]
117     }
118 
119     /// Creates a vector from the first 3 values in `slice`.
120     ///
121     /// # Panics
122     ///
123     /// Panics if `slice` is less than 3 elements long.
124     #[inline]
125     #[must_use]
from_slice(slice: &[i64]) -> Self126     pub const fn from_slice(slice: &[i64]) -> Self {
127         assert!(slice.len() >= 3);
128         Self::new(slice[0], slice[1], slice[2])
129     }
130 
131     /// Writes the elements of `self` to the first 3 elements in `slice`.
132     ///
133     /// # Panics
134     ///
135     /// Panics if `slice` is less than 3 elements long.
136     #[inline]
write_to_slice(self, slice: &mut [i64])137     pub fn write_to_slice(self, slice: &mut [i64]) {
138         slice[..3].copy_from_slice(&self.to_array());
139     }
140 
141     /// Internal method for creating a 3D vector from a 4D vector, discarding `w`.
142     #[allow(dead_code)]
143     #[inline]
144     #[must_use]
from_vec4(v: I64Vec4) -> Self145     pub(crate) fn from_vec4(v: I64Vec4) -> Self {
146         Self {
147             x: v.x,
148             y: v.y,
149             z: v.z,
150         }
151     }
152 
153     /// Creates a 4D vector from `self` and the given `w` value.
154     #[inline]
155     #[must_use]
extend(self, w: i64) -> I64Vec4156     pub fn extend(self, w: i64) -> I64Vec4 {
157         I64Vec4::new(self.x, self.y, self.z, w)
158     }
159 
160     /// Creates a 2D vector from the `x` and `y` elements of `self`, discarding `z`.
161     ///
162     /// Truncation may also be performed by using [`self.xy()`][crate::swizzles::Vec3Swizzles::xy()].
163     #[inline]
164     #[must_use]
truncate(self) -> I64Vec2165     pub fn truncate(self) -> I64Vec2 {
166         use crate::swizzles::Vec3Swizzles;
167         self.xy()
168     }
169 
170     /// Creates a 3D vector from `self` with the given value of `x`.
171     #[inline]
172     #[must_use]
with_x(mut self, x: i64) -> Self173     pub fn with_x(mut self, x: i64) -> Self {
174         self.x = x;
175         self
176     }
177 
178     /// Creates a 3D vector from `self` with the given value of `y`.
179     #[inline]
180     #[must_use]
with_y(mut self, y: i64) -> Self181     pub fn with_y(mut self, y: i64) -> Self {
182         self.y = y;
183         self
184     }
185 
186     /// Creates a 3D vector from `self` with the given value of `z`.
187     #[inline]
188     #[must_use]
with_z(mut self, z: i64) -> Self189     pub fn with_z(mut self, z: i64) -> Self {
190         self.z = z;
191         self
192     }
193 
194     /// Computes the dot product of `self` and `rhs`.
195     #[inline]
196     #[must_use]
dot(self, rhs: Self) -> i64197     pub fn dot(self, rhs: Self) -> i64 {
198         (self.x * rhs.x) + (self.y * rhs.y) + (self.z * rhs.z)
199     }
200 
201     /// Returns a vector where every component is the dot product of `self` and `rhs`.
202     #[inline]
203     #[must_use]
dot_into_vec(self, rhs: Self) -> Self204     pub fn dot_into_vec(self, rhs: Self) -> Self {
205         Self::splat(self.dot(rhs))
206     }
207 
208     /// Computes the cross product of `self` and `rhs`.
209     #[inline]
210     #[must_use]
cross(self, rhs: Self) -> Self211     pub fn cross(self, rhs: Self) -> Self {
212         Self {
213             x: self.y * rhs.z - rhs.y * self.z,
214             y: self.z * rhs.x - rhs.z * self.x,
215             z: self.x * rhs.y - rhs.x * self.y,
216         }
217     }
218 
219     /// Returns a vector containing the minimum values for each element of `self` and `rhs`.
220     ///
221     /// In other words this computes `[self.x.min(rhs.x), self.y.min(rhs.y), ..]`.
222     #[inline]
223     #[must_use]
min(self, rhs: Self) -> Self224     pub fn min(self, rhs: Self) -> Self {
225         Self {
226             x: self.x.min(rhs.x),
227             y: self.y.min(rhs.y),
228             z: self.z.min(rhs.z),
229         }
230     }
231 
232     /// Returns a vector containing the maximum values for each element of `self` and `rhs`.
233     ///
234     /// In other words this computes `[self.x.max(rhs.x), self.y.max(rhs.y), ..]`.
235     #[inline]
236     #[must_use]
max(self, rhs: Self) -> Self237     pub fn max(self, rhs: Self) -> Self {
238         Self {
239             x: self.x.max(rhs.x),
240             y: self.y.max(rhs.y),
241             z: self.z.max(rhs.z),
242         }
243     }
244 
245     /// Component-wise clamping of values, similar to [`i64::clamp`].
246     ///
247     /// Each element in `min` must be less-or-equal to the corresponding element in `max`.
248     ///
249     /// # Panics
250     ///
251     /// Will panic if `min` is greater than `max` when `glam_assert` is enabled.
252     #[inline]
253     #[must_use]
clamp(self, min: Self, max: Self) -> Self254     pub fn clamp(self, min: Self, max: Self) -> Self {
255         glam_assert!(min.cmple(max).all(), "clamp: expected min <= max");
256         self.max(min).min(max)
257     }
258 
259     /// Returns the horizontal minimum of `self`.
260     ///
261     /// In other words this computes `min(x, y, ..)`.
262     #[inline]
263     #[must_use]
min_element(self) -> i64264     pub fn min_element(self) -> i64 {
265         self.x.min(self.y.min(self.z))
266     }
267 
268     /// Returns the horizontal maximum of `self`.
269     ///
270     /// In other words this computes `max(x, y, ..)`.
271     #[inline]
272     #[must_use]
max_element(self) -> i64273     pub fn max_element(self) -> i64 {
274         self.x.max(self.y.max(self.z))
275     }
276 
277     /// Returns the sum of all elements of `self`.
278     ///
279     /// In other words, this computes `self.x + self.y + ..`.
280     #[inline]
281     #[must_use]
element_sum(self) -> i64282     pub fn element_sum(self) -> i64 {
283         self.x + self.y + self.z
284     }
285 
286     /// Returns the product of all elements of `self`.
287     ///
288     /// In other words, this computes `self.x * self.y * ..`.
289     #[inline]
290     #[must_use]
element_product(self) -> i64291     pub fn element_product(self) -> i64 {
292         self.x * self.y * self.z
293     }
294 
295     /// Returns a vector mask containing the result of a `==` comparison for each element of
296     /// `self` and `rhs`.
297     ///
298     /// In other words, this computes `[self.x == rhs.x, self.y == rhs.y, ..]` for all
299     /// elements.
300     #[inline]
301     #[must_use]
cmpeq(self, rhs: Self) -> BVec3302     pub fn cmpeq(self, rhs: Self) -> BVec3 {
303         BVec3::new(self.x.eq(&rhs.x), self.y.eq(&rhs.y), self.z.eq(&rhs.z))
304     }
305 
306     /// Returns a vector mask containing the result of a `!=` comparison for each element of
307     /// `self` and `rhs`.
308     ///
309     /// In other words this computes `[self.x != rhs.x, self.y != rhs.y, ..]` for all
310     /// elements.
311     #[inline]
312     #[must_use]
cmpne(self, rhs: Self) -> BVec3313     pub fn cmpne(self, rhs: Self) -> BVec3 {
314         BVec3::new(self.x.ne(&rhs.x), self.y.ne(&rhs.y), self.z.ne(&rhs.z))
315     }
316 
317     /// Returns a vector mask containing the result of a `>=` comparison for each element of
318     /// `self` and `rhs`.
319     ///
320     /// In other words this computes `[self.x >= rhs.x, self.y >= rhs.y, ..]` for all
321     /// elements.
322     #[inline]
323     #[must_use]
cmpge(self, rhs: Self) -> BVec3324     pub fn cmpge(self, rhs: Self) -> BVec3 {
325         BVec3::new(self.x.ge(&rhs.x), self.y.ge(&rhs.y), self.z.ge(&rhs.z))
326     }
327 
328     /// Returns a vector mask containing the result of a `>` comparison for each element of
329     /// `self` and `rhs`.
330     ///
331     /// In other words this computes `[self.x > rhs.x, self.y > rhs.y, ..]` for all
332     /// elements.
333     #[inline]
334     #[must_use]
cmpgt(self, rhs: Self) -> BVec3335     pub fn cmpgt(self, rhs: Self) -> BVec3 {
336         BVec3::new(self.x.gt(&rhs.x), self.y.gt(&rhs.y), self.z.gt(&rhs.z))
337     }
338 
339     /// Returns a vector mask containing the result of a `<=` comparison for each element of
340     /// `self` and `rhs`.
341     ///
342     /// In other words this computes `[self.x <= rhs.x, self.y <= rhs.y, ..]` for all
343     /// elements.
344     #[inline]
345     #[must_use]
cmple(self, rhs: Self) -> BVec3346     pub fn cmple(self, rhs: Self) -> BVec3 {
347         BVec3::new(self.x.le(&rhs.x), self.y.le(&rhs.y), self.z.le(&rhs.z))
348     }
349 
350     /// Returns a vector mask containing the result of a `<` comparison for each element of
351     /// `self` and `rhs`.
352     ///
353     /// In other words this computes `[self.x < rhs.x, self.y < rhs.y, ..]` for all
354     /// elements.
355     #[inline]
356     #[must_use]
cmplt(self, rhs: Self) -> BVec3357     pub fn cmplt(self, rhs: Self) -> BVec3 {
358         BVec3::new(self.x.lt(&rhs.x), self.y.lt(&rhs.y), self.z.lt(&rhs.z))
359     }
360 
361     /// Returns a vector containing the absolute value of each element of `self`.
362     #[inline]
363     #[must_use]
abs(self) -> Self364     pub fn abs(self) -> Self {
365         Self {
366             x: self.x.abs(),
367             y: self.y.abs(),
368             z: self.z.abs(),
369         }
370     }
371 
372     /// Returns a vector with elements representing the sign of `self`.
373     ///
374     ///  - `0` if the number is zero
375     ///  - `1` if the number is positive
376     ///  - `-1` if the number is negative
377     #[inline]
378     #[must_use]
signum(self) -> Self379     pub fn signum(self) -> Self {
380         Self {
381             x: self.x.signum(),
382             y: self.y.signum(),
383             z: self.z.signum(),
384         }
385     }
386 
387     /// Returns a bitmask with the lowest 3 bits set to the sign bits from the elements of `self`.
388     ///
389     /// A negative element results in a `1` bit and a positive element in a `0` bit.  Element `x` goes
390     /// into the first lowest bit, element `y` into the second, etc.
391     #[inline]
392     #[must_use]
is_negative_bitmask(self) -> u32393     pub fn is_negative_bitmask(self) -> u32 {
394         (self.x.is_negative() as u32)
395             | (self.y.is_negative() as u32) << 1
396             | (self.z.is_negative() as u32) << 2
397     }
398 
399     /// Computes the squared length of `self`.
400     #[doc(alias = "magnitude2")]
401     #[inline]
402     #[must_use]
length_squared(self) -> i64403     pub fn length_squared(self) -> i64 {
404         self.dot(self)
405     }
406 
407     /// Compute the squared euclidean distance between two points in space.
408     #[inline]
409     #[must_use]
distance_squared(self, rhs: Self) -> i64410     pub fn distance_squared(self, rhs: Self) -> i64 {
411         (self - rhs).length_squared()
412     }
413 
414     /// Returns the element-wise quotient of [Euclidean division] of `self` by `rhs`.
415     ///
416     /// # Panics
417     /// This function will panic if any `rhs` element is 0 or the division results in overflow.
418     #[inline]
419     #[must_use]
div_euclid(self, rhs: Self) -> Self420     pub fn div_euclid(self, rhs: Self) -> Self {
421         Self::new(
422             self.x.div_euclid(rhs.x),
423             self.y.div_euclid(rhs.y),
424             self.z.div_euclid(rhs.z),
425         )
426     }
427 
428     /// Returns the element-wise remainder of [Euclidean division] of `self` by `rhs`.
429     ///
430     /// # Panics
431     /// This function will panic if any `rhs` element is 0 or the division results in overflow.
432     ///
433     /// [Euclidean division]: i64::rem_euclid
434     #[inline]
435     #[must_use]
rem_euclid(self, rhs: Self) -> Self436     pub fn rem_euclid(self, rhs: Self) -> Self {
437         Self::new(
438             self.x.rem_euclid(rhs.x),
439             self.y.rem_euclid(rhs.y),
440             self.z.rem_euclid(rhs.z),
441         )
442     }
443 
444     /// Computes the [manhattan distance] between two points.
445     ///
446     /// # Overflow
447     /// This method may overflow if the result is greater than [`u64::MAX`].
448     ///
449     /// See also [`checked_manhattan_distance`][I64Vec3::checked_manhattan_distance].
450     ///
451     /// [manhattan distance]: https://en.wikipedia.org/wiki/Taxicab_geometry
452     #[inline]
453     #[must_use]
manhattan_distance(self, other: Self) -> u64454     pub fn manhattan_distance(self, other: Self) -> u64 {
455         self.x.abs_diff(other.x) + self.y.abs_diff(other.y) + self.z.abs_diff(other.z)
456     }
457 
458     /// Computes the [manhattan distance] between two points.
459     ///
460     /// This will returns [`None`] if the result is greater than [`u64::MAX`].
461     ///
462     /// [manhattan distance]: https://en.wikipedia.org/wiki/Taxicab_geometry
463     #[inline]
464     #[must_use]
checked_manhattan_distance(self, other: Self) -> Option<u64>465     pub fn checked_manhattan_distance(self, other: Self) -> Option<u64> {
466         let d = self.x.abs_diff(other.x);
467         let d = d.checked_add(self.y.abs_diff(other.y))?;
468         d.checked_add(self.z.abs_diff(other.z))
469     }
470 
471     /// Computes the [chebyshev distance] between two points.
472     ///
473     /// [chebyshev distance]: https://en.wikipedia.org/wiki/Chebyshev_distance
474     #[inline]
475     #[must_use]
chebyshev_distance(self, other: Self) -> u64476     pub fn chebyshev_distance(self, other: Self) -> u64 {
477         // Note: the compiler will eventually optimize out the loop
478         [
479             self.x.abs_diff(other.x),
480             self.y.abs_diff(other.y),
481             self.z.abs_diff(other.z),
482         ]
483         .into_iter()
484         .max()
485         .unwrap()
486     }
487 
488     /// Casts all elements of `self` to `f32`.
489     #[inline]
490     #[must_use]
as_vec3(&self) -> crate::Vec3491     pub fn as_vec3(&self) -> crate::Vec3 {
492         crate::Vec3::new(self.x as f32, self.y as f32, self.z as f32)
493     }
494 
495     /// Casts all elements of `self` to `f32`.
496     #[inline]
497     #[must_use]
as_vec3a(&self) -> crate::Vec3A498     pub fn as_vec3a(&self) -> crate::Vec3A {
499         crate::Vec3A::new(self.x as f32, self.y as f32, self.z as f32)
500     }
501 
502     /// Casts all elements of `self` to `f64`.
503     #[inline]
504     #[must_use]
as_dvec3(&self) -> crate::DVec3505     pub fn as_dvec3(&self) -> crate::DVec3 {
506         crate::DVec3::new(self.x as f64, self.y as f64, self.z as f64)
507     }
508 
509     /// Casts all elements of `self` to `i8`.
510     #[inline]
511     #[must_use]
as_i8vec3(&self) -> crate::I8Vec3512     pub fn as_i8vec3(&self) -> crate::I8Vec3 {
513         crate::I8Vec3::new(self.x as i8, self.y as i8, self.z as i8)
514     }
515 
516     /// Casts all elements of `self` to `u8`.
517     #[inline]
518     #[must_use]
as_u8vec3(&self) -> crate::U8Vec3519     pub fn as_u8vec3(&self) -> crate::U8Vec3 {
520         crate::U8Vec3::new(self.x as u8, self.y as u8, self.z as u8)
521     }
522 
523     /// Casts all elements of `self` to `i16`.
524     #[inline]
525     #[must_use]
as_i16vec3(&self) -> crate::I16Vec3526     pub fn as_i16vec3(&self) -> crate::I16Vec3 {
527         crate::I16Vec3::new(self.x as i16, self.y as i16, self.z as i16)
528     }
529 
530     /// Casts all elements of `self` to `u16`.
531     #[inline]
532     #[must_use]
as_u16vec3(&self) -> crate::U16Vec3533     pub fn as_u16vec3(&self) -> crate::U16Vec3 {
534         crate::U16Vec3::new(self.x as u16, self.y as u16, self.z as u16)
535     }
536 
537     /// Casts all elements of `self` to `i32`.
538     #[inline]
539     #[must_use]
as_ivec3(&self) -> crate::IVec3540     pub fn as_ivec3(&self) -> crate::IVec3 {
541         crate::IVec3::new(self.x as i32, self.y as i32, self.z as i32)
542     }
543 
544     /// Casts all elements of `self` to `u32`.
545     #[inline]
546     #[must_use]
as_uvec3(&self) -> crate::UVec3547     pub fn as_uvec3(&self) -> crate::UVec3 {
548         crate::UVec3::new(self.x as u32, self.y as u32, self.z as u32)
549     }
550 
551     /// Casts all elements of `self` to `u64`.
552     #[inline]
553     #[must_use]
as_u64vec3(&self) -> crate::U64Vec3554     pub fn as_u64vec3(&self) -> crate::U64Vec3 {
555         crate::U64Vec3::new(self.x as u64, self.y as u64, self.z as u64)
556     }
557 
558     /// Returns a vector containing the wrapping addition of `self` and `rhs`.
559     ///
560     /// In other words this computes `Some([self.x + rhs.x, self.y + rhs.y, ..])` but returns `None` on any overflow.
561     #[inline]
562     #[must_use]
checked_add(self, rhs: Self) -> Option<Self>563     pub const fn checked_add(self, rhs: Self) -> Option<Self> {
564         let x = match self.x.checked_add(rhs.x) {
565             Some(v) => v,
566             None => return None,
567         };
568         let y = match self.y.checked_add(rhs.y) {
569             Some(v) => v,
570             None => return None,
571         };
572         let z = match self.z.checked_add(rhs.z) {
573             Some(v) => v,
574             None => return None,
575         };
576 
577         Some(Self { x, y, z })
578     }
579 
580     /// Returns a vector containing the wrapping subtraction of `self` and `rhs`.
581     ///
582     /// In other words this computes `Some([self.x - rhs.x, self.y - rhs.y, ..])` but returns `None` on any overflow.
583     #[inline]
584     #[must_use]
checked_sub(self, rhs: Self) -> Option<Self>585     pub const fn checked_sub(self, rhs: Self) -> Option<Self> {
586         let x = match self.x.checked_sub(rhs.x) {
587             Some(v) => v,
588             None => return None,
589         };
590         let y = match self.y.checked_sub(rhs.y) {
591             Some(v) => v,
592             None => return None,
593         };
594         let z = match self.z.checked_sub(rhs.z) {
595             Some(v) => v,
596             None => return None,
597         };
598 
599         Some(Self { x, y, z })
600     }
601 
602     /// Returns a vector containing the wrapping multiplication of `self` and `rhs`.
603     ///
604     /// In other words this computes `Some([self.x * rhs.x, self.y * rhs.y, ..])` but returns `None` on any overflow.
605     #[inline]
606     #[must_use]
checked_mul(self, rhs: Self) -> Option<Self>607     pub const fn checked_mul(self, rhs: Self) -> Option<Self> {
608         let x = match self.x.checked_mul(rhs.x) {
609             Some(v) => v,
610             None => return None,
611         };
612         let y = match self.y.checked_mul(rhs.y) {
613             Some(v) => v,
614             None => return None,
615         };
616         let z = match self.z.checked_mul(rhs.z) {
617             Some(v) => v,
618             None => return None,
619         };
620 
621         Some(Self { x, y, z })
622     }
623 
624     /// Returns a vector containing the wrapping division of `self` and `rhs`.
625     ///
626     /// In other words this computes `Some([self.x / rhs.x, self.y / rhs.y, ..])` but returns `None` on any division by zero.
627     #[inline]
628     #[must_use]
checked_div(self, rhs: Self) -> Option<Self>629     pub const fn checked_div(self, rhs: Self) -> Option<Self> {
630         let x = match self.x.checked_div(rhs.x) {
631             Some(v) => v,
632             None => return None,
633         };
634         let y = match self.y.checked_div(rhs.y) {
635             Some(v) => v,
636             None => return None,
637         };
638         let z = match self.z.checked_div(rhs.z) {
639             Some(v) => v,
640             None => return None,
641         };
642 
643         Some(Self { x, y, z })
644     }
645 
646     /// Returns a vector containing the wrapping addition of `self` and `rhs`.
647     ///
648     /// In other words this computes `[self.x.wrapping_add(rhs.x), self.y.wrapping_add(rhs.y), ..]`.
649     #[inline]
650     #[must_use]
wrapping_add(self, rhs: Self) -> Self651     pub const fn wrapping_add(self, rhs: Self) -> Self {
652         Self {
653             x: self.x.wrapping_add(rhs.x),
654             y: self.y.wrapping_add(rhs.y),
655             z: self.z.wrapping_add(rhs.z),
656         }
657     }
658 
659     /// Returns a vector containing the wrapping subtraction of `self` and `rhs`.
660     ///
661     /// In other words this computes `[self.x.wrapping_sub(rhs.x), self.y.wrapping_sub(rhs.y), ..]`.
662     #[inline]
663     #[must_use]
wrapping_sub(self, rhs: Self) -> Self664     pub const fn wrapping_sub(self, rhs: Self) -> Self {
665         Self {
666             x: self.x.wrapping_sub(rhs.x),
667             y: self.y.wrapping_sub(rhs.y),
668             z: self.z.wrapping_sub(rhs.z),
669         }
670     }
671 
672     /// Returns a vector containing the wrapping multiplication of `self` and `rhs`.
673     ///
674     /// In other words this computes `[self.x.wrapping_mul(rhs.x), self.y.wrapping_mul(rhs.y), ..]`.
675     #[inline]
676     #[must_use]
wrapping_mul(self, rhs: Self) -> Self677     pub const fn wrapping_mul(self, rhs: Self) -> Self {
678         Self {
679             x: self.x.wrapping_mul(rhs.x),
680             y: self.y.wrapping_mul(rhs.y),
681             z: self.z.wrapping_mul(rhs.z),
682         }
683     }
684 
685     /// Returns a vector containing the wrapping division of `self` and `rhs`.
686     ///
687     /// In other words this computes `[self.x.wrapping_div(rhs.x), self.y.wrapping_div(rhs.y), ..]`.
688     #[inline]
689     #[must_use]
wrapping_div(self, rhs: Self) -> Self690     pub const fn wrapping_div(self, rhs: Self) -> Self {
691         Self {
692             x: self.x.wrapping_div(rhs.x),
693             y: self.y.wrapping_div(rhs.y),
694             z: self.z.wrapping_div(rhs.z),
695         }
696     }
697 
698     /// Returns a vector containing the saturating addition of `self` and `rhs`.
699     ///
700     /// In other words this computes `[self.x.saturating_add(rhs.x), self.y.saturating_add(rhs.y), ..]`.
701     #[inline]
702     #[must_use]
saturating_add(self, rhs: Self) -> Self703     pub const fn saturating_add(self, rhs: Self) -> Self {
704         Self {
705             x: self.x.saturating_add(rhs.x),
706             y: self.y.saturating_add(rhs.y),
707             z: self.z.saturating_add(rhs.z),
708         }
709     }
710 
711     /// Returns a vector containing the saturating subtraction of `self` and `rhs`.
712     ///
713     /// In other words this computes `[self.x.saturating_sub(rhs.x), self.y.saturating_sub(rhs.y), ..]`.
714     #[inline]
715     #[must_use]
saturating_sub(self, rhs: Self) -> Self716     pub const fn saturating_sub(self, rhs: Self) -> Self {
717         Self {
718             x: self.x.saturating_sub(rhs.x),
719             y: self.y.saturating_sub(rhs.y),
720             z: self.z.saturating_sub(rhs.z),
721         }
722     }
723 
724     /// Returns a vector containing the saturating multiplication of `self` and `rhs`.
725     ///
726     /// In other words this computes `[self.x.saturating_mul(rhs.x), self.y.saturating_mul(rhs.y), ..]`.
727     #[inline]
728     #[must_use]
saturating_mul(self, rhs: Self) -> Self729     pub const fn saturating_mul(self, rhs: Self) -> Self {
730         Self {
731             x: self.x.saturating_mul(rhs.x),
732             y: self.y.saturating_mul(rhs.y),
733             z: self.z.saturating_mul(rhs.z),
734         }
735     }
736 
737     /// Returns a vector containing the saturating division of `self` and `rhs`.
738     ///
739     /// In other words this computes `[self.x.saturating_div(rhs.x), self.y.saturating_div(rhs.y), ..]`.
740     #[inline]
741     #[must_use]
saturating_div(self, rhs: Self) -> Self742     pub const fn saturating_div(self, rhs: Self) -> Self {
743         Self {
744             x: self.x.saturating_div(rhs.x),
745             y: self.y.saturating_div(rhs.y),
746             z: self.z.saturating_div(rhs.z),
747         }
748     }
749 
750     /// Returns a vector containing the wrapping addition of `self` and unsigned vector `rhs`.
751     ///
752     /// In other words this computes `Some([self.x + rhs.x, self.y + rhs.y, ..])` but returns `None` on any overflow.
753     #[inline]
754     #[must_use]
checked_add_unsigned(self, rhs: U64Vec3) -> Option<Self>755     pub const fn checked_add_unsigned(self, rhs: U64Vec3) -> Option<Self> {
756         let x = match self.x.checked_add_unsigned(rhs.x) {
757             Some(v) => v,
758             None => return None,
759         };
760         let y = match self.y.checked_add_unsigned(rhs.y) {
761             Some(v) => v,
762             None => return None,
763         };
764         let z = match self.z.checked_add_unsigned(rhs.z) {
765             Some(v) => v,
766             None => return None,
767         };
768 
769         Some(Self { x, y, z })
770     }
771 
772     /// Returns a vector containing the wrapping subtraction of `self` and unsigned vector `rhs`.
773     ///
774     /// In other words this computes `Some([self.x - rhs.x, self.y - rhs.y, ..])` but returns `None` on any overflow.
775     #[inline]
776     #[must_use]
checked_sub_unsigned(self, rhs: U64Vec3) -> Option<Self>777     pub const fn checked_sub_unsigned(self, rhs: U64Vec3) -> Option<Self> {
778         let x = match self.x.checked_sub_unsigned(rhs.x) {
779             Some(v) => v,
780             None => return None,
781         };
782         let y = match self.y.checked_sub_unsigned(rhs.y) {
783             Some(v) => v,
784             None => return None,
785         };
786         let z = match self.z.checked_sub_unsigned(rhs.z) {
787             Some(v) => v,
788             None => return None,
789         };
790 
791         Some(Self { x, y, z })
792     }
793 
794     /// Returns a vector containing the wrapping addition of `self` and unsigned vector `rhs`.
795     ///
796     /// In other words this computes `[self.x.wrapping_add_unsigned(rhs.x), self.y.wrapping_add_unsigned(rhs.y), ..]`.
797     #[inline]
798     #[must_use]
wrapping_add_unsigned(self, rhs: U64Vec3) -> Self799     pub const fn wrapping_add_unsigned(self, rhs: U64Vec3) -> Self {
800         Self {
801             x: self.x.wrapping_add_unsigned(rhs.x),
802             y: self.y.wrapping_add_unsigned(rhs.y),
803             z: self.z.wrapping_add_unsigned(rhs.z),
804         }
805     }
806 
807     /// Returns a vector containing the wrapping subtraction of `self` and unsigned vector `rhs`.
808     ///
809     /// In other words this computes `[self.x.wrapping_sub_unsigned(rhs.x), self.y.wrapping_sub_unsigned(rhs.y), ..]`.
810     #[inline]
811     #[must_use]
wrapping_sub_unsigned(self, rhs: U64Vec3) -> Self812     pub const fn wrapping_sub_unsigned(self, rhs: U64Vec3) -> Self {
813         Self {
814             x: self.x.wrapping_sub_unsigned(rhs.x),
815             y: self.y.wrapping_sub_unsigned(rhs.y),
816             z: self.z.wrapping_sub_unsigned(rhs.z),
817         }
818     }
819 
820     // Returns a vector containing the saturating addition of `self` and unsigned vector `rhs`.
821     ///
822     /// In other words this computes `[self.x.saturating_add_unsigned(rhs.x), self.y.saturating_add_unsigned(rhs.y), ..]`.
823     #[inline]
824     #[must_use]
saturating_add_unsigned(self, rhs: U64Vec3) -> Self825     pub const fn saturating_add_unsigned(self, rhs: U64Vec3) -> Self {
826         Self {
827             x: self.x.saturating_add_unsigned(rhs.x),
828             y: self.y.saturating_add_unsigned(rhs.y),
829             z: self.z.saturating_add_unsigned(rhs.z),
830         }
831     }
832 
833     /// Returns a vector containing the saturating subtraction of `self` and unsigned vector `rhs`.
834     ///
835     /// In other words this computes `[self.x.saturating_sub_unsigned(rhs.x), self.y.saturating_sub_unsigned(rhs.y), ..]`.
836     #[inline]
837     #[must_use]
saturating_sub_unsigned(self, rhs: U64Vec3) -> Self838     pub const fn saturating_sub_unsigned(self, rhs: U64Vec3) -> Self {
839         Self {
840             x: self.x.saturating_sub_unsigned(rhs.x),
841             y: self.y.saturating_sub_unsigned(rhs.y),
842             z: self.z.saturating_sub_unsigned(rhs.z),
843         }
844     }
845 }
846 
847 impl Default for I64Vec3 {
848     #[inline(always)]
default() -> Self849     fn default() -> Self {
850         Self::ZERO
851     }
852 }
853 
854 impl Div<I64Vec3> for I64Vec3 {
855     type Output = Self;
856     #[inline]
div(self, rhs: Self) -> Self857     fn div(self, rhs: Self) -> Self {
858         Self {
859             x: self.x.div(rhs.x),
860             y: self.y.div(rhs.y),
861             z: self.z.div(rhs.z),
862         }
863     }
864 }
865 
866 impl Div<&I64Vec3> for I64Vec3 {
867     type Output = I64Vec3;
868     #[inline]
div(self, rhs: &I64Vec3) -> I64Vec3869     fn div(self, rhs: &I64Vec3) -> I64Vec3 {
870         self.div(*rhs)
871     }
872 }
873 
874 impl Div<&I64Vec3> for &I64Vec3 {
875     type Output = I64Vec3;
876     #[inline]
div(self, rhs: &I64Vec3) -> I64Vec3877     fn div(self, rhs: &I64Vec3) -> I64Vec3 {
878         (*self).div(*rhs)
879     }
880 }
881 
882 impl Div<I64Vec3> for &I64Vec3 {
883     type Output = I64Vec3;
884     #[inline]
div(self, rhs: I64Vec3) -> I64Vec3885     fn div(self, rhs: I64Vec3) -> I64Vec3 {
886         (*self).div(rhs)
887     }
888 }
889 
890 impl DivAssign<I64Vec3> for I64Vec3 {
891     #[inline]
div_assign(&mut self, rhs: Self)892     fn div_assign(&mut self, rhs: Self) {
893         self.x.div_assign(rhs.x);
894         self.y.div_assign(rhs.y);
895         self.z.div_assign(rhs.z);
896     }
897 }
898 
899 impl DivAssign<&I64Vec3> for I64Vec3 {
900     #[inline]
div_assign(&mut self, rhs: &I64Vec3)901     fn div_assign(&mut self, rhs: &I64Vec3) {
902         self.div_assign(*rhs)
903     }
904 }
905 
906 impl Div<i64> for I64Vec3 {
907     type Output = Self;
908     #[inline]
div(self, rhs: i64) -> Self909     fn div(self, rhs: i64) -> Self {
910         Self {
911             x: self.x.div(rhs),
912             y: self.y.div(rhs),
913             z: self.z.div(rhs),
914         }
915     }
916 }
917 
918 impl Div<&i64> for I64Vec3 {
919     type Output = I64Vec3;
920     #[inline]
div(self, rhs: &i64) -> I64Vec3921     fn div(self, rhs: &i64) -> I64Vec3 {
922         self.div(*rhs)
923     }
924 }
925 
926 impl Div<&i64> for &I64Vec3 {
927     type Output = I64Vec3;
928     #[inline]
div(self, rhs: &i64) -> I64Vec3929     fn div(self, rhs: &i64) -> I64Vec3 {
930         (*self).div(*rhs)
931     }
932 }
933 
934 impl Div<i64> for &I64Vec3 {
935     type Output = I64Vec3;
936     #[inline]
div(self, rhs: i64) -> I64Vec3937     fn div(self, rhs: i64) -> I64Vec3 {
938         (*self).div(rhs)
939     }
940 }
941 
942 impl DivAssign<i64> for I64Vec3 {
943     #[inline]
div_assign(&mut self, rhs: i64)944     fn div_assign(&mut self, rhs: i64) {
945         self.x.div_assign(rhs);
946         self.y.div_assign(rhs);
947         self.z.div_assign(rhs);
948     }
949 }
950 
951 impl DivAssign<&i64> for I64Vec3 {
952     #[inline]
div_assign(&mut self, rhs: &i64)953     fn div_assign(&mut self, rhs: &i64) {
954         self.div_assign(*rhs)
955     }
956 }
957 
958 impl Div<I64Vec3> for i64 {
959     type Output = I64Vec3;
960     #[inline]
div(self, rhs: I64Vec3) -> I64Vec3961     fn div(self, rhs: I64Vec3) -> I64Vec3 {
962         I64Vec3 {
963             x: self.div(rhs.x),
964             y: self.div(rhs.y),
965             z: self.div(rhs.z),
966         }
967     }
968 }
969 
970 impl Div<&I64Vec3> for i64 {
971     type Output = I64Vec3;
972     #[inline]
div(self, rhs: &I64Vec3) -> I64Vec3973     fn div(self, rhs: &I64Vec3) -> I64Vec3 {
974         self.div(*rhs)
975     }
976 }
977 
978 impl Div<&I64Vec3> for &i64 {
979     type Output = I64Vec3;
980     #[inline]
div(self, rhs: &I64Vec3) -> I64Vec3981     fn div(self, rhs: &I64Vec3) -> I64Vec3 {
982         (*self).div(*rhs)
983     }
984 }
985 
986 impl Div<I64Vec3> for &i64 {
987     type Output = I64Vec3;
988     #[inline]
div(self, rhs: I64Vec3) -> I64Vec3989     fn div(self, rhs: I64Vec3) -> I64Vec3 {
990         (*self).div(rhs)
991     }
992 }
993 
994 impl Mul<I64Vec3> for I64Vec3 {
995     type Output = Self;
996     #[inline]
mul(self, rhs: Self) -> Self997     fn mul(self, rhs: Self) -> Self {
998         Self {
999             x: self.x.mul(rhs.x),
1000             y: self.y.mul(rhs.y),
1001             z: self.z.mul(rhs.z),
1002         }
1003     }
1004 }
1005 
1006 impl Mul<&I64Vec3> for I64Vec3 {
1007     type Output = I64Vec3;
1008     #[inline]
mul(self, rhs: &I64Vec3) -> I64Vec31009     fn mul(self, rhs: &I64Vec3) -> I64Vec3 {
1010         self.mul(*rhs)
1011     }
1012 }
1013 
1014 impl Mul<&I64Vec3> for &I64Vec3 {
1015     type Output = I64Vec3;
1016     #[inline]
mul(self, rhs: &I64Vec3) -> I64Vec31017     fn mul(self, rhs: &I64Vec3) -> I64Vec3 {
1018         (*self).mul(*rhs)
1019     }
1020 }
1021 
1022 impl Mul<I64Vec3> for &I64Vec3 {
1023     type Output = I64Vec3;
1024     #[inline]
mul(self, rhs: I64Vec3) -> I64Vec31025     fn mul(self, rhs: I64Vec3) -> I64Vec3 {
1026         (*self).mul(rhs)
1027     }
1028 }
1029 
1030 impl MulAssign<I64Vec3> for I64Vec3 {
1031     #[inline]
mul_assign(&mut self, rhs: Self)1032     fn mul_assign(&mut self, rhs: Self) {
1033         self.x.mul_assign(rhs.x);
1034         self.y.mul_assign(rhs.y);
1035         self.z.mul_assign(rhs.z);
1036     }
1037 }
1038 
1039 impl MulAssign<&I64Vec3> for I64Vec3 {
1040     #[inline]
mul_assign(&mut self, rhs: &I64Vec3)1041     fn mul_assign(&mut self, rhs: &I64Vec3) {
1042         self.mul_assign(*rhs)
1043     }
1044 }
1045 
1046 impl Mul<i64> for I64Vec3 {
1047     type Output = Self;
1048     #[inline]
mul(self, rhs: i64) -> Self1049     fn mul(self, rhs: i64) -> Self {
1050         Self {
1051             x: self.x.mul(rhs),
1052             y: self.y.mul(rhs),
1053             z: self.z.mul(rhs),
1054         }
1055     }
1056 }
1057 
1058 impl Mul<&i64> for I64Vec3 {
1059     type Output = I64Vec3;
1060     #[inline]
mul(self, rhs: &i64) -> I64Vec31061     fn mul(self, rhs: &i64) -> I64Vec3 {
1062         self.mul(*rhs)
1063     }
1064 }
1065 
1066 impl Mul<&i64> for &I64Vec3 {
1067     type Output = I64Vec3;
1068     #[inline]
mul(self, rhs: &i64) -> I64Vec31069     fn mul(self, rhs: &i64) -> I64Vec3 {
1070         (*self).mul(*rhs)
1071     }
1072 }
1073 
1074 impl Mul<i64> for &I64Vec3 {
1075     type Output = I64Vec3;
1076     #[inline]
mul(self, rhs: i64) -> I64Vec31077     fn mul(self, rhs: i64) -> I64Vec3 {
1078         (*self).mul(rhs)
1079     }
1080 }
1081 
1082 impl MulAssign<i64> for I64Vec3 {
1083     #[inline]
mul_assign(&mut self, rhs: i64)1084     fn mul_assign(&mut self, rhs: i64) {
1085         self.x.mul_assign(rhs);
1086         self.y.mul_assign(rhs);
1087         self.z.mul_assign(rhs);
1088     }
1089 }
1090 
1091 impl MulAssign<&i64> for I64Vec3 {
1092     #[inline]
mul_assign(&mut self, rhs: &i64)1093     fn mul_assign(&mut self, rhs: &i64) {
1094         self.mul_assign(*rhs)
1095     }
1096 }
1097 
1098 impl Mul<I64Vec3> for i64 {
1099     type Output = I64Vec3;
1100     #[inline]
mul(self, rhs: I64Vec3) -> I64Vec31101     fn mul(self, rhs: I64Vec3) -> I64Vec3 {
1102         I64Vec3 {
1103             x: self.mul(rhs.x),
1104             y: self.mul(rhs.y),
1105             z: self.mul(rhs.z),
1106         }
1107     }
1108 }
1109 
1110 impl Mul<&I64Vec3> for i64 {
1111     type Output = I64Vec3;
1112     #[inline]
mul(self, rhs: &I64Vec3) -> I64Vec31113     fn mul(self, rhs: &I64Vec3) -> I64Vec3 {
1114         self.mul(*rhs)
1115     }
1116 }
1117 
1118 impl Mul<&I64Vec3> for &i64 {
1119     type Output = I64Vec3;
1120     #[inline]
mul(self, rhs: &I64Vec3) -> I64Vec31121     fn mul(self, rhs: &I64Vec3) -> I64Vec3 {
1122         (*self).mul(*rhs)
1123     }
1124 }
1125 
1126 impl Mul<I64Vec3> for &i64 {
1127     type Output = I64Vec3;
1128     #[inline]
mul(self, rhs: I64Vec3) -> I64Vec31129     fn mul(self, rhs: I64Vec3) -> I64Vec3 {
1130         (*self).mul(rhs)
1131     }
1132 }
1133 
1134 impl Add<I64Vec3> for I64Vec3 {
1135     type Output = Self;
1136     #[inline]
add(self, rhs: Self) -> Self1137     fn add(self, rhs: Self) -> Self {
1138         Self {
1139             x: self.x.add(rhs.x),
1140             y: self.y.add(rhs.y),
1141             z: self.z.add(rhs.z),
1142         }
1143     }
1144 }
1145 
1146 impl Add<&I64Vec3> for I64Vec3 {
1147     type Output = I64Vec3;
1148     #[inline]
add(self, rhs: &I64Vec3) -> I64Vec31149     fn add(self, rhs: &I64Vec3) -> I64Vec3 {
1150         self.add(*rhs)
1151     }
1152 }
1153 
1154 impl Add<&I64Vec3> for &I64Vec3 {
1155     type Output = I64Vec3;
1156     #[inline]
add(self, rhs: &I64Vec3) -> I64Vec31157     fn add(self, rhs: &I64Vec3) -> I64Vec3 {
1158         (*self).add(*rhs)
1159     }
1160 }
1161 
1162 impl Add<I64Vec3> for &I64Vec3 {
1163     type Output = I64Vec3;
1164     #[inline]
add(self, rhs: I64Vec3) -> I64Vec31165     fn add(self, rhs: I64Vec3) -> I64Vec3 {
1166         (*self).add(rhs)
1167     }
1168 }
1169 
1170 impl AddAssign<I64Vec3> for I64Vec3 {
1171     #[inline]
add_assign(&mut self, rhs: Self)1172     fn add_assign(&mut self, rhs: Self) {
1173         self.x.add_assign(rhs.x);
1174         self.y.add_assign(rhs.y);
1175         self.z.add_assign(rhs.z);
1176     }
1177 }
1178 
1179 impl AddAssign<&I64Vec3> for I64Vec3 {
1180     #[inline]
add_assign(&mut self, rhs: &I64Vec3)1181     fn add_assign(&mut self, rhs: &I64Vec3) {
1182         self.add_assign(*rhs)
1183     }
1184 }
1185 
1186 impl Add<i64> for I64Vec3 {
1187     type Output = Self;
1188     #[inline]
add(self, rhs: i64) -> Self1189     fn add(self, rhs: i64) -> Self {
1190         Self {
1191             x: self.x.add(rhs),
1192             y: self.y.add(rhs),
1193             z: self.z.add(rhs),
1194         }
1195     }
1196 }
1197 
1198 impl Add<&i64> for I64Vec3 {
1199     type Output = I64Vec3;
1200     #[inline]
add(self, rhs: &i64) -> I64Vec31201     fn add(self, rhs: &i64) -> I64Vec3 {
1202         self.add(*rhs)
1203     }
1204 }
1205 
1206 impl Add<&i64> for &I64Vec3 {
1207     type Output = I64Vec3;
1208     #[inline]
add(self, rhs: &i64) -> I64Vec31209     fn add(self, rhs: &i64) -> I64Vec3 {
1210         (*self).add(*rhs)
1211     }
1212 }
1213 
1214 impl Add<i64> for &I64Vec3 {
1215     type Output = I64Vec3;
1216     #[inline]
add(self, rhs: i64) -> I64Vec31217     fn add(self, rhs: i64) -> I64Vec3 {
1218         (*self).add(rhs)
1219     }
1220 }
1221 
1222 impl AddAssign<i64> for I64Vec3 {
1223     #[inline]
add_assign(&mut self, rhs: i64)1224     fn add_assign(&mut self, rhs: i64) {
1225         self.x.add_assign(rhs);
1226         self.y.add_assign(rhs);
1227         self.z.add_assign(rhs);
1228     }
1229 }
1230 
1231 impl AddAssign<&i64> for I64Vec3 {
1232     #[inline]
add_assign(&mut self, rhs: &i64)1233     fn add_assign(&mut self, rhs: &i64) {
1234         self.add_assign(*rhs)
1235     }
1236 }
1237 
1238 impl Add<I64Vec3> for i64 {
1239     type Output = I64Vec3;
1240     #[inline]
add(self, rhs: I64Vec3) -> I64Vec31241     fn add(self, rhs: I64Vec3) -> I64Vec3 {
1242         I64Vec3 {
1243             x: self.add(rhs.x),
1244             y: self.add(rhs.y),
1245             z: self.add(rhs.z),
1246         }
1247     }
1248 }
1249 
1250 impl Add<&I64Vec3> for i64 {
1251     type Output = I64Vec3;
1252     #[inline]
add(self, rhs: &I64Vec3) -> I64Vec31253     fn add(self, rhs: &I64Vec3) -> I64Vec3 {
1254         self.add(*rhs)
1255     }
1256 }
1257 
1258 impl Add<&I64Vec3> for &i64 {
1259     type Output = I64Vec3;
1260     #[inline]
add(self, rhs: &I64Vec3) -> I64Vec31261     fn add(self, rhs: &I64Vec3) -> I64Vec3 {
1262         (*self).add(*rhs)
1263     }
1264 }
1265 
1266 impl Add<I64Vec3> for &i64 {
1267     type Output = I64Vec3;
1268     #[inline]
add(self, rhs: I64Vec3) -> I64Vec31269     fn add(self, rhs: I64Vec3) -> I64Vec3 {
1270         (*self).add(rhs)
1271     }
1272 }
1273 
1274 impl Sub<I64Vec3> for I64Vec3 {
1275     type Output = Self;
1276     #[inline]
sub(self, rhs: Self) -> Self1277     fn sub(self, rhs: Self) -> Self {
1278         Self {
1279             x: self.x.sub(rhs.x),
1280             y: self.y.sub(rhs.y),
1281             z: self.z.sub(rhs.z),
1282         }
1283     }
1284 }
1285 
1286 impl Sub<&I64Vec3> for I64Vec3 {
1287     type Output = I64Vec3;
1288     #[inline]
sub(self, rhs: &I64Vec3) -> I64Vec31289     fn sub(self, rhs: &I64Vec3) -> I64Vec3 {
1290         self.sub(*rhs)
1291     }
1292 }
1293 
1294 impl Sub<&I64Vec3> for &I64Vec3 {
1295     type Output = I64Vec3;
1296     #[inline]
sub(self, rhs: &I64Vec3) -> I64Vec31297     fn sub(self, rhs: &I64Vec3) -> I64Vec3 {
1298         (*self).sub(*rhs)
1299     }
1300 }
1301 
1302 impl Sub<I64Vec3> for &I64Vec3 {
1303     type Output = I64Vec3;
1304     #[inline]
sub(self, rhs: I64Vec3) -> I64Vec31305     fn sub(self, rhs: I64Vec3) -> I64Vec3 {
1306         (*self).sub(rhs)
1307     }
1308 }
1309 
1310 impl SubAssign<I64Vec3> for I64Vec3 {
1311     #[inline]
sub_assign(&mut self, rhs: I64Vec3)1312     fn sub_assign(&mut self, rhs: I64Vec3) {
1313         self.x.sub_assign(rhs.x);
1314         self.y.sub_assign(rhs.y);
1315         self.z.sub_assign(rhs.z);
1316     }
1317 }
1318 
1319 impl SubAssign<&I64Vec3> for I64Vec3 {
1320     #[inline]
sub_assign(&mut self, rhs: &I64Vec3)1321     fn sub_assign(&mut self, rhs: &I64Vec3) {
1322         self.sub_assign(*rhs)
1323     }
1324 }
1325 
1326 impl Sub<i64> for I64Vec3 {
1327     type Output = Self;
1328     #[inline]
sub(self, rhs: i64) -> Self1329     fn sub(self, rhs: i64) -> Self {
1330         Self {
1331             x: self.x.sub(rhs),
1332             y: self.y.sub(rhs),
1333             z: self.z.sub(rhs),
1334         }
1335     }
1336 }
1337 
1338 impl Sub<&i64> for I64Vec3 {
1339     type Output = I64Vec3;
1340     #[inline]
sub(self, rhs: &i64) -> I64Vec31341     fn sub(self, rhs: &i64) -> I64Vec3 {
1342         self.sub(*rhs)
1343     }
1344 }
1345 
1346 impl Sub<&i64> for &I64Vec3 {
1347     type Output = I64Vec3;
1348     #[inline]
sub(self, rhs: &i64) -> I64Vec31349     fn sub(self, rhs: &i64) -> I64Vec3 {
1350         (*self).sub(*rhs)
1351     }
1352 }
1353 
1354 impl Sub<i64> for &I64Vec3 {
1355     type Output = I64Vec3;
1356     #[inline]
sub(self, rhs: i64) -> I64Vec31357     fn sub(self, rhs: i64) -> I64Vec3 {
1358         (*self).sub(rhs)
1359     }
1360 }
1361 
1362 impl SubAssign<i64> for I64Vec3 {
1363     #[inline]
sub_assign(&mut self, rhs: i64)1364     fn sub_assign(&mut self, rhs: i64) {
1365         self.x.sub_assign(rhs);
1366         self.y.sub_assign(rhs);
1367         self.z.sub_assign(rhs);
1368     }
1369 }
1370 
1371 impl SubAssign<&i64> for I64Vec3 {
1372     #[inline]
sub_assign(&mut self, rhs: &i64)1373     fn sub_assign(&mut self, rhs: &i64) {
1374         self.sub_assign(*rhs)
1375     }
1376 }
1377 
1378 impl Sub<I64Vec3> for i64 {
1379     type Output = I64Vec3;
1380     #[inline]
sub(self, rhs: I64Vec3) -> I64Vec31381     fn sub(self, rhs: I64Vec3) -> I64Vec3 {
1382         I64Vec3 {
1383             x: self.sub(rhs.x),
1384             y: self.sub(rhs.y),
1385             z: self.sub(rhs.z),
1386         }
1387     }
1388 }
1389 
1390 impl Sub<&I64Vec3> for i64 {
1391     type Output = I64Vec3;
1392     #[inline]
sub(self, rhs: &I64Vec3) -> I64Vec31393     fn sub(self, rhs: &I64Vec3) -> I64Vec3 {
1394         self.sub(*rhs)
1395     }
1396 }
1397 
1398 impl Sub<&I64Vec3> for &i64 {
1399     type Output = I64Vec3;
1400     #[inline]
sub(self, rhs: &I64Vec3) -> I64Vec31401     fn sub(self, rhs: &I64Vec3) -> I64Vec3 {
1402         (*self).sub(*rhs)
1403     }
1404 }
1405 
1406 impl Sub<I64Vec3> for &i64 {
1407     type Output = I64Vec3;
1408     #[inline]
sub(self, rhs: I64Vec3) -> I64Vec31409     fn sub(self, rhs: I64Vec3) -> I64Vec3 {
1410         (*self).sub(rhs)
1411     }
1412 }
1413 
1414 impl Rem<I64Vec3> for I64Vec3 {
1415     type Output = Self;
1416     #[inline]
rem(self, rhs: Self) -> Self1417     fn rem(self, rhs: Self) -> Self {
1418         Self {
1419             x: self.x.rem(rhs.x),
1420             y: self.y.rem(rhs.y),
1421             z: self.z.rem(rhs.z),
1422         }
1423     }
1424 }
1425 
1426 impl Rem<&I64Vec3> for I64Vec3 {
1427     type Output = I64Vec3;
1428     #[inline]
rem(self, rhs: &I64Vec3) -> I64Vec31429     fn rem(self, rhs: &I64Vec3) -> I64Vec3 {
1430         self.rem(*rhs)
1431     }
1432 }
1433 
1434 impl Rem<&I64Vec3> for &I64Vec3 {
1435     type Output = I64Vec3;
1436     #[inline]
rem(self, rhs: &I64Vec3) -> I64Vec31437     fn rem(self, rhs: &I64Vec3) -> I64Vec3 {
1438         (*self).rem(*rhs)
1439     }
1440 }
1441 
1442 impl Rem<I64Vec3> for &I64Vec3 {
1443     type Output = I64Vec3;
1444     #[inline]
rem(self, rhs: I64Vec3) -> I64Vec31445     fn rem(self, rhs: I64Vec3) -> I64Vec3 {
1446         (*self).rem(rhs)
1447     }
1448 }
1449 
1450 impl RemAssign<I64Vec3> for I64Vec3 {
1451     #[inline]
rem_assign(&mut self, rhs: Self)1452     fn rem_assign(&mut self, rhs: Self) {
1453         self.x.rem_assign(rhs.x);
1454         self.y.rem_assign(rhs.y);
1455         self.z.rem_assign(rhs.z);
1456     }
1457 }
1458 
1459 impl RemAssign<&I64Vec3> for I64Vec3 {
1460     #[inline]
rem_assign(&mut self, rhs: &I64Vec3)1461     fn rem_assign(&mut self, rhs: &I64Vec3) {
1462         self.rem_assign(*rhs)
1463     }
1464 }
1465 
1466 impl Rem<i64> for I64Vec3 {
1467     type Output = Self;
1468     #[inline]
rem(self, rhs: i64) -> Self1469     fn rem(self, rhs: i64) -> Self {
1470         Self {
1471             x: self.x.rem(rhs),
1472             y: self.y.rem(rhs),
1473             z: self.z.rem(rhs),
1474         }
1475     }
1476 }
1477 
1478 impl Rem<&i64> for I64Vec3 {
1479     type Output = I64Vec3;
1480     #[inline]
rem(self, rhs: &i64) -> I64Vec31481     fn rem(self, rhs: &i64) -> I64Vec3 {
1482         self.rem(*rhs)
1483     }
1484 }
1485 
1486 impl Rem<&i64> for &I64Vec3 {
1487     type Output = I64Vec3;
1488     #[inline]
rem(self, rhs: &i64) -> I64Vec31489     fn rem(self, rhs: &i64) -> I64Vec3 {
1490         (*self).rem(*rhs)
1491     }
1492 }
1493 
1494 impl Rem<i64> for &I64Vec3 {
1495     type Output = I64Vec3;
1496     #[inline]
rem(self, rhs: i64) -> I64Vec31497     fn rem(self, rhs: i64) -> I64Vec3 {
1498         (*self).rem(rhs)
1499     }
1500 }
1501 
1502 impl RemAssign<i64> for I64Vec3 {
1503     #[inline]
rem_assign(&mut self, rhs: i64)1504     fn rem_assign(&mut self, rhs: i64) {
1505         self.x.rem_assign(rhs);
1506         self.y.rem_assign(rhs);
1507         self.z.rem_assign(rhs);
1508     }
1509 }
1510 
1511 impl RemAssign<&i64> for I64Vec3 {
1512     #[inline]
rem_assign(&mut self, rhs: &i64)1513     fn rem_assign(&mut self, rhs: &i64) {
1514         self.rem_assign(*rhs)
1515     }
1516 }
1517 
1518 impl Rem<I64Vec3> for i64 {
1519     type Output = I64Vec3;
1520     #[inline]
rem(self, rhs: I64Vec3) -> I64Vec31521     fn rem(self, rhs: I64Vec3) -> I64Vec3 {
1522         I64Vec3 {
1523             x: self.rem(rhs.x),
1524             y: self.rem(rhs.y),
1525             z: self.rem(rhs.z),
1526         }
1527     }
1528 }
1529 
1530 impl Rem<&I64Vec3> for i64 {
1531     type Output = I64Vec3;
1532     #[inline]
rem(self, rhs: &I64Vec3) -> I64Vec31533     fn rem(self, rhs: &I64Vec3) -> I64Vec3 {
1534         self.rem(*rhs)
1535     }
1536 }
1537 
1538 impl Rem<&I64Vec3> for &i64 {
1539     type Output = I64Vec3;
1540     #[inline]
rem(self, rhs: &I64Vec3) -> I64Vec31541     fn rem(self, rhs: &I64Vec3) -> I64Vec3 {
1542         (*self).rem(*rhs)
1543     }
1544 }
1545 
1546 impl Rem<I64Vec3> for &i64 {
1547     type Output = I64Vec3;
1548     #[inline]
rem(self, rhs: I64Vec3) -> I64Vec31549     fn rem(self, rhs: I64Vec3) -> I64Vec3 {
1550         (*self).rem(rhs)
1551     }
1552 }
1553 
1554 #[cfg(not(target_arch = "spirv"))]
1555 impl AsRef<[i64; 3]> for I64Vec3 {
1556     #[inline]
as_ref(&self) -> &[i64; 3]1557     fn as_ref(&self) -> &[i64; 3] {
1558         unsafe { &*(self as *const I64Vec3 as *const [i64; 3]) }
1559     }
1560 }
1561 
1562 #[cfg(not(target_arch = "spirv"))]
1563 impl AsMut<[i64; 3]> for I64Vec3 {
1564     #[inline]
as_mut(&mut self) -> &mut [i64; 3]1565     fn as_mut(&mut self) -> &mut [i64; 3] {
1566         unsafe { &mut *(self as *mut I64Vec3 as *mut [i64; 3]) }
1567     }
1568 }
1569 
1570 impl Sum for I64Vec3 {
1571     #[inline]
sum<I>(iter: I) -> Self where I: Iterator<Item = Self>,1572     fn sum<I>(iter: I) -> Self
1573     where
1574         I: Iterator<Item = Self>,
1575     {
1576         iter.fold(Self::ZERO, Self::add)
1577     }
1578 }
1579 
1580 impl<'a> Sum<&'a Self> for I64Vec3 {
1581     #[inline]
sum<I>(iter: I) -> Self where I: Iterator<Item = &'a Self>,1582     fn sum<I>(iter: I) -> Self
1583     where
1584         I: Iterator<Item = &'a Self>,
1585     {
1586         iter.fold(Self::ZERO, |a, &b| Self::add(a, b))
1587     }
1588 }
1589 
1590 impl Product for I64Vec3 {
1591     #[inline]
product<I>(iter: I) -> Self where I: Iterator<Item = Self>,1592     fn product<I>(iter: I) -> Self
1593     where
1594         I: Iterator<Item = Self>,
1595     {
1596         iter.fold(Self::ONE, Self::mul)
1597     }
1598 }
1599 
1600 impl<'a> Product<&'a Self> for I64Vec3 {
1601     #[inline]
product<I>(iter: I) -> Self where I: Iterator<Item = &'a Self>,1602     fn product<I>(iter: I) -> Self
1603     where
1604         I: Iterator<Item = &'a Self>,
1605     {
1606         iter.fold(Self::ONE, |a, &b| Self::mul(a, b))
1607     }
1608 }
1609 
1610 impl Neg for I64Vec3 {
1611     type Output = Self;
1612     #[inline]
neg(self) -> Self1613     fn neg(self) -> Self {
1614         Self {
1615             x: self.x.neg(),
1616             y: self.y.neg(),
1617             z: self.z.neg(),
1618         }
1619     }
1620 }
1621 
1622 impl Neg for &I64Vec3 {
1623     type Output = I64Vec3;
1624     #[inline]
neg(self) -> I64Vec31625     fn neg(self) -> I64Vec3 {
1626         (*self).neg()
1627     }
1628 }
1629 
1630 impl Not for I64Vec3 {
1631     type Output = Self;
1632     #[inline]
not(self) -> Self::Output1633     fn not(self) -> Self::Output {
1634         Self {
1635             x: self.x.not(),
1636             y: self.y.not(),
1637             z: self.z.not(),
1638         }
1639     }
1640 }
1641 
1642 impl BitAnd for I64Vec3 {
1643     type Output = Self;
1644     #[inline]
bitand(self, rhs: Self) -> Self::Output1645     fn bitand(self, rhs: Self) -> Self::Output {
1646         Self {
1647             x: self.x.bitand(rhs.x),
1648             y: self.y.bitand(rhs.y),
1649             z: self.z.bitand(rhs.z),
1650         }
1651     }
1652 }
1653 
1654 impl BitOr for I64Vec3 {
1655     type Output = Self;
1656     #[inline]
bitor(self, rhs: Self) -> Self::Output1657     fn bitor(self, rhs: Self) -> Self::Output {
1658         Self {
1659             x: self.x.bitor(rhs.x),
1660             y: self.y.bitor(rhs.y),
1661             z: self.z.bitor(rhs.z),
1662         }
1663     }
1664 }
1665 
1666 impl BitXor for I64Vec3 {
1667     type Output = Self;
1668     #[inline]
bitxor(self, rhs: Self) -> Self::Output1669     fn bitxor(self, rhs: Self) -> Self::Output {
1670         Self {
1671             x: self.x.bitxor(rhs.x),
1672             y: self.y.bitxor(rhs.y),
1673             z: self.z.bitxor(rhs.z),
1674         }
1675     }
1676 }
1677 
1678 impl BitAnd<i64> for I64Vec3 {
1679     type Output = Self;
1680     #[inline]
bitand(self, rhs: i64) -> Self::Output1681     fn bitand(self, rhs: i64) -> Self::Output {
1682         Self {
1683             x: self.x.bitand(rhs),
1684             y: self.y.bitand(rhs),
1685             z: self.z.bitand(rhs),
1686         }
1687     }
1688 }
1689 
1690 impl BitOr<i64> for I64Vec3 {
1691     type Output = Self;
1692     #[inline]
bitor(self, rhs: i64) -> Self::Output1693     fn bitor(self, rhs: i64) -> Self::Output {
1694         Self {
1695             x: self.x.bitor(rhs),
1696             y: self.y.bitor(rhs),
1697             z: self.z.bitor(rhs),
1698         }
1699     }
1700 }
1701 
1702 impl BitXor<i64> for I64Vec3 {
1703     type Output = Self;
1704     #[inline]
bitxor(self, rhs: i64) -> Self::Output1705     fn bitxor(self, rhs: i64) -> Self::Output {
1706         Self {
1707             x: self.x.bitxor(rhs),
1708             y: self.y.bitxor(rhs),
1709             z: self.z.bitxor(rhs),
1710         }
1711     }
1712 }
1713 
1714 impl Shl<i8> for I64Vec3 {
1715     type Output = Self;
1716     #[inline]
shl(self, rhs: i8) -> Self::Output1717     fn shl(self, rhs: i8) -> Self::Output {
1718         Self {
1719             x: self.x.shl(rhs),
1720             y: self.y.shl(rhs),
1721             z: self.z.shl(rhs),
1722         }
1723     }
1724 }
1725 
1726 impl Shr<i8> for I64Vec3 {
1727     type Output = Self;
1728     #[inline]
shr(self, rhs: i8) -> Self::Output1729     fn shr(self, rhs: i8) -> Self::Output {
1730         Self {
1731             x: self.x.shr(rhs),
1732             y: self.y.shr(rhs),
1733             z: self.z.shr(rhs),
1734         }
1735     }
1736 }
1737 
1738 impl Shl<i16> for I64Vec3 {
1739     type Output = Self;
1740     #[inline]
shl(self, rhs: i16) -> Self::Output1741     fn shl(self, rhs: i16) -> Self::Output {
1742         Self {
1743             x: self.x.shl(rhs),
1744             y: self.y.shl(rhs),
1745             z: self.z.shl(rhs),
1746         }
1747     }
1748 }
1749 
1750 impl Shr<i16> for I64Vec3 {
1751     type Output = Self;
1752     #[inline]
shr(self, rhs: i16) -> Self::Output1753     fn shr(self, rhs: i16) -> Self::Output {
1754         Self {
1755             x: self.x.shr(rhs),
1756             y: self.y.shr(rhs),
1757             z: self.z.shr(rhs),
1758         }
1759     }
1760 }
1761 
1762 impl Shl<i32> for I64Vec3 {
1763     type Output = Self;
1764     #[inline]
shl(self, rhs: i32) -> Self::Output1765     fn shl(self, rhs: i32) -> Self::Output {
1766         Self {
1767             x: self.x.shl(rhs),
1768             y: self.y.shl(rhs),
1769             z: self.z.shl(rhs),
1770         }
1771     }
1772 }
1773 
1774 impl Shr<i32> for I64Vec3 {
1775     type Output = Self;
1776     #[inline]
shr(self, rhs: i32) -> Self::Output1777     fn shr(self, rhs: i32) -> Self::Output {
1778         Self {
1779             x: self.x.shr(rhs),
1780             y: self.y.shr(rhs),
1781             z: self.z.shr(rhs),
1782         }
1783     }
1784 }
1785 
1786 impl Shl<i64> for I64Vec3 {
1787     type Output = Self;
1788     #[inline]
shl(self, rhs: i64) -> Self::Output1789     fn shl(self, rhs: i64) -> Self::Output {
1790         Self {
1791             x: self.x.shl(rhs),
1792             y: self.y.shl(rhs),
1793             z: self.z.shl(rhs),
1794         }
1795     }
1796 }
1797 
1798 impl Shr<i64> for I64Vec3 {
1799     type Output = Self;
1800     #[inline]
shr(self, rhs: i64) -> Self::Output1801     fn shr(self, rhs: i64) -> Self::Output {
1802         Self {
1803             x: self.x.shr(rhs),
1804             y: self.y.shr(rhs),
1805             z: self.z.shr(rhs),
1806         }
1807     }
1808 }
1809 
1810 impl Shl<u8> for I64Vec3 {
1811     type Output = Self;
1812     #[inline]
shl(self, rhs: u8) -> Self::Output1813     fn shl(self, rhs: u8) -> Self::Output {
1814         Self {
1815             x: self.x.shl(rhs),
1816             y: self.y.shl(rhs),
1817             z: self.z.shl(rhs),
1818         }
1819     }
1820 }
1821 
1822 impl Shr<u8> for I64Vec3 {
1823     type Output = Self;
1824     #[inline]
shr(self, rhs: u8) -> Self::Output1825     fn shr(self, rhs: u8) -> Self::Output {
1826         Self {
1827             x: self.x.shr(rhs),
1828             y: self.y.shr(rhs),
1829             z: self.z.shr(rhs),
1830         }
1831     }
1832 }
1833 
1834 impl Shl<u16> for I64Vec3 {
1835     type Output = Self;
1836     #[inline]
shl(self, rhs: u16) -> Self::Output1837     fn shl(self, rhs: u16) -> Self::Output {
1838         Self {
1839             x: self.x.shl(rhs),
1840             y: self.y.shl(rhs),
1841             z: self.z.shl(rhs),
1842         }
1843     }
1844 }
1845 
1846 impl Shr<u16> for I64Vec3 {
1847     type Output = Self;
1848     #[inline]
shr(self, rhs: u16) -> Self::Output1849     fn shr(self, rhs: u16) -> Self::Output {
1850         Self {
1851             x: self.x.shr(rhs),
1852             y: self.y.shr(rhs),
1853             z: self.z.shr(rhs),
1854         }
1855     }
1856 }
1857 
1858 impl Shl<u32> for I64Vec3 {
1859     type Output = Self;
1860     #[inline]
shl(self, rhs: u32) -> Self::Output1861     fn shl(self, rhs: u32) -> Self::Output {
1862         Self {
1863             x: self.x.shl(rhs),
1864             y: self.y.shl(rhs),
1865             z: self.z.shl(rhs),
1866         }
1867     }
1868 }
1869 
1870 impl Shr<u32> for I64Vec3 {
1871     type Output = Self;
1872     #[inline]
shr(self, rhs: u32) -> Self::Output1873     fn shr(self, rhs: u32) -> Self::Output {
1874         Self {
1875             x: self.x.shr(rhs),
1876             y: self.y.shr(rhs),
1877             z: self.z.shr(rhs),
1878         }
1879     }
1880 }
1881 
1882 impl Shl<u64> for I64Vec3 {
1883     type Output = Self;
1884     #[inline]
shl(self, rhs: u64) -> Self::Output1885     fn shl(self, rhs: u64) -> Self::Output {
1886         Self {
1887             x: self.x.shl(rhs),
1888             y: self.y.shl(rhs),
1889             z: self.z.shl(rhs),
1890         }
1891     }
1892 }
1893 
1894 impl Shr<u64> for I64Vec3 {
1895     type Output = Self;
1896     #[inline]
shr(self, rhs: u64) -> Self::Output1897     fn shr(self, rhs: u64) -> 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 
1906 impl Shl<crate::IVec3> for I64Vec3 {
1907     type Output = Self;
1908     #[inline]
shl(self, rhs: crate::IVec3) -> Self::Output1909     fn shl(self, rhs: crate::IVec3) -> Self::Output {
1910         Self {
1911             x: self.x.shl(rhs.x),
1912             y: self.y.shl(rhs.y),
1913             z: self.z.shl(rhs.z),
1914         }
1915     }
1916 }
1917 
1918 impl Shr<crate::IVec3> for I64Vec3 {
1919     type Output = Self;
1920     #[inline]
shr(self, rhs: crate::IVec3) -> Self::Output1921     fn shr(self, rhs: crate::IVec3) -> Self::Output {
1922         Self {
1923             x: self.x.shr(rhs.x),
1924             y: self.y.shr(rhs.y),
1925             z: self.z.shr(rhs.z),
1926         }
1927     }
1928 }
1929 
1930 impl Shl<crate::UVec3> for I64Vec3 {
1931     type Output = Self;
1932     #[inline]
shl(self, rhs: crate::UVec3) -> Self::Output1933     fn shl(self, rhs: crate::UVec3) -> Self::Output {
1934         Self {
1935             x: self.x.shl(rhs.x),
1936             y: self.y.shl(rhs.y),
1937             z: self.z.shl(rhs.z),
1938         }
1939     }
1940 }
1941 
1942 impl Shr<crate::UVec3> for I64Vec3 {
1943     type Output = Self;
1944     #[inline]
shr(self, rhs: crate::UVec3) -> Self::Output1945     fn shr(self, rhs: crate::UVec3) -> Self::Output {
1946         Self {
1947             x: self.x.shr(rhs.x),
1948             y: self.y.shr(rhs.y),
1949             z: self.z.shr(rhs.z),
1950         }
1951     }
1952 }
1953 
1954 impl Index<usize> for I64Vec3 {
1955     type Output = i64;
1956     #[inline]
index(&self, index: usize) -> &Self::Output1957     fn index(&self, index: usize) -> &Self::Output {
1958         match index {
1959             0 => &self.x,
1960             1 => &self.y,
1961             2 => &self.z,
1962             _ => panic!("index out of bounds"),
1963         }
1964     }
1965 }
1966 
1967 impl IndexMut<usize> for I64Vec3 {
1968     #[inline]
index_mut(&mut self, index: usize) -> &mut Self::Output1969     fn index_mut(&mut self, index: usize) -> &mut Self::Output {
1970         match index {
1971             0 => &mut self.x,
1972             1 => &mut self.y,
1973             2 => &mut self.z,
1974             _ => panic!("index out of bounds"),
1975         }
1976     }
1977 }
1978 
1979 impl fmt::Display for I64Vec3 {
fmt(&self, f: &mut fmt::Formatter<'_>) -> fmt::Result1980     fn fmt(&self, f: &mut fmt::Formatter<'_>) -> fmt::Result {
1981         write!(f, "[{}, {}, {}]", self.x, self.y, self.z)
1982     }
1983 }
1984 
1985 impl fmt::Debug for I64Vec3 {
fmt(&self, fmt: &mut fmt::Formatter<'_>) -> fmt::Result1986     fn fmt(&self, fmt: &mut fmt::Formatter<'_>) -> fmt::Result {
1987         fmt.debug_tuple(stringify!(I64Vec3))
1988             .field(&self.x)
1989             .field(&self.y)
1990             .field(&self.z)
1991             .finish()
1992     }
1993 }
1994 
1995 impl From<[i64; 3]> for I64Vec3 {
1996     #[inline]
from(a: [i64; 3]) -> Self1997     fn from(a: [i64; 3]) -> Self {
1998         Self::new(a[0], a[1], a[2])
1999     }
2000 }
2001 
2002 impl From<I64Vec3> for [i64; 3] {
2003     #[inline]
from(v: I64Vec3) -> Self2004     fn from(v: I64Vec3) -> Self {
2005         [v.x, v.y, v.z]
2006     }
2007 }
2008 
2009 impl From<(i64, i64, i64)> for I64Vec3 {
2010     #[inline]
from(t: (i64, i64, i64)) -> Self2011     fn from(t: (i64, i64, i64)) -> Self {
2012         Self::new(t.0, t.1, t.2)
2013     }
2014 }
2015 
2016 impl From<I64Vec3> for (i64, i64, i64) {
2017     #[inline]
from(v: I64Vec3) -> Self2018     fn from(v: I64Vec3) -> Self {
2019         (v.x, v.y, v.z)
2020     }
2021 }
2022 
2023 impl From<(I64Vec2, i64)> for I64Vec3 {
2024     #[inline]
from((v, z): (I64Vec2, i64)) -> Self2025     fn from((v, z): (I64Vec2, i64)) -> Self {
2026         Self::new(v.x, v.y, z)
2027     }
2028 }
2029 
2030 impl From<I8Vec3> for I64Vec3 {
2031     #[inline]
from(v: I8Vec3) -> Self2032     fn from(v: I8Vec3) -> Self {
2033         Self::new(i64::from(v.x), i64::from(v.y), i64::from(v.z))
2034     }
2035 }
2036 
2037 impl From<U8Vec3> for I64Vec3 {
2038     #[inline]
from(v: U8Vec3) -> Self2039     fn from(v: U8Vec3) -> Self {
2040         Self::new(i64::from(v.x), i64::from(v.y), i64::from(v.z))
2041     }
2042 }
2043 
2044 impl From<I16Vec3> for I64Vec3 {
2045     #[inline]
from(v: I16Vec3) -> Self2046     fn from(v: I16Vec3) -> Self {
2047         Self::new(i64::from(v.x), i64::from(v.y), i64::from(v.z))
2048     }
2049 }
2050 
2051 impl From<U16Vec3> for I64Vec3 {
2052     #[inline]
from(v: U16Vec3) -> Self2053     fn from(v: U16Vec3) -> Self {
2054         Self::new(i64::from(v.x), i64::from(v.y), i64::from(v.z))
2055     }
2056 }
2057 
2058 impl From<IVec3> for I64Vec3 {
2059     #[inline]
from(v: IVec3) -> Self2060     fn from(v: IVec3) -> Self {
2061         Self::new(i64::from(v.x), i64::from(v.y), i64::from(v.z))
2062     }
2063 }
2064 
2065 impl From<UVec3> for I64Vec3 {
2066     #[inline]
from(v: UVec3) -> Self2067     fn from(v: UVec3) -> Self {
2068         Self::new(i64::from(v.x), i64::from(v.y), i64::from(v.z))
2069     }
2070 }
2071 
2072 impl TryFrom<U64Vec3> for I64Vec3 {
2073     type Error = core::num::TryFromIntError;
2074 
2075     #[inline]
try_from(v: U64Vec3) -> Result<Self, Self::Error>2076     fn try_from(v: U64Vec3) -> Result<Self, Self::Error> {
2077         Ok(Self::new(
2078             i64::try_from(v.x)?,
2079             i64::try_from(v.y)?,
2080             i64::try_from(v.z)?,
2081         ))
2082     }
2083 }
2084 
2085 impl From<BVec3> for I64Vec3 {
2086     #[inline]
from(v: BVec3) -> Self2087     fn from(v: BVec3) -> Self {
2088         Self::new(i64::from(v.x), i64::from(v.y), i64::from(v.z))
2089     }
2090 }
2091 
2092 impl From<BVec3A> for I64Vec3 {
2093     #[inline]
from(v: BVec3A) -> Self2094     fn from(v: BVec3A) -> Self {
2095         let bool_array: [bool; 3] = v.into();
2096         Self::new(
2097             i64::from(bool_array[0]),
2098             i64::from(bool_array[1]),
2099             i64::from(bool_array[2]),
2100         )
2101     }
2102 }
2103