glam/u8/
u8vec2.rs

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