glam/u8/
u8vec2.rs

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