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