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