glam/isize/
isizevec2.rs

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