Skip to main content

glam/isize/
isizevec2.rs

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