• Home
  • Features
  • Pricing
  • Docs
  • Announcements
  • Sign In

bitshifter / glam-rs / 24918269367

25 Apr 2026 12:40AM UTC coverage: 97.134%. Remained the same
24918269367

push

github

bitshifter
Add types are conditional.

57276 of 58966 relevant lines covered (97.13%)

3.48 hits per line

Source File
Press 'n' to go to next uncovered line, 'b' for previous

98.65
/src/u8/u8vec2.rs
1
// Generated from vec.rs.tera template. Edit the template, not the generated file.
2

3
use crate::{BVec2, U8Vec3};
4

5
#[cfg(feature = "i8")]
6
use crate::I8Vec2;
7

8
#[cfg(feature = "i16")]
9
use crate::I16Vec2;
10

11
#[cfg(feature = "u16")]
12
use crate::U16Vec2;
13

14
#[cfg(feature = "i32")]
15
use crate::IVec2;
16

17
#[cfg(feature = "u32")]
18
use crate::UVec2;
19

20
#[cfg(feature = "i64")]
21
use crate::I64Vec2;
22

23
#[cfg(feature = "u64")]
24
use crate::U64Vec2;
25

26
#[cfg(feature = "isize")]
27
use crate::ISizeVec2;
28

29
#[cfg(feature = "usize")]
30
use crate::USizeVec2;
31

32
use core::fmt;
33
use core::iter::{Product, Sum};
34
use core::{f32, ops::*};
35

36
#[cfg(feature = "zerocopy")]
37
use zerocopy_derive::*;
38

39
/// Creates a 2-dimensional vector.
40
#[inline(always)]
41
#[must_use]
42
pub const fn u8vec2(x: u8, y: u8) -> U8Vec2 {
6✔
43
    U8Vec2::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",
51
    derive(FromBytes, Immutable, IntoBytes, KnownLayout)
52
)]
53
#[cfg_attr(feature = "cuda", repr(align(2)))]
54
#[repr(C)]
55
#[cfg_attr(target_arch = "spirv", rust_gpu::vector::v1)]
56
pub struct U8Vec2 {
57
    pub x: u8,
58
    pub y: u8,
59
}
60

61
impl U8Vec2 {
62
    /// All zeroes.
63
    pub const ZERO: Self = Self::splat(0);
64

65
    /// All ones.
66
    pub const ONE: Self = Self::splat(1);
67

68
    /// All `u8::MIN`.
69
    pub const MIN: Self = Self::splat(u8::MIN);
70

71
    /// All `u8::MAX`.
72
    pub const MAX: Self = Self::splat(u8::MAX);
73

74
    /// A unit vector pointing along the positive X axis.
75
    pub const X: Self = Self::new(1, 0);
76

77
    /// A unit vector pointing along the positive Y axis.
78
    pub const Y: Self = Self::new(0, 1);
79

80
    /// The unit axes.
81
    pub const AXES: [Self; 2] = [Self::X, Self::Y];
82

83
    /// Creates a new vector.
84
    #[inline(always)]
85
    #[must_use]
86
    pub const fn new(x: u8, y: u8) -> Self {
9✔
87
        Self { x, y }
88
    }
89

90
    /// Creates a vector with all elements set to `v`.
91
    #[inline]
92
    #[must_use]
93
    pub const fn splat(v: u8) -> Self {
3✔
94
        Self { x: v, y: v }
95
    }
96

97
    /// Returns a vector containing each element of `self` modified by a mapping function `f`.
98
    #[inline]
99
    #[must_use]
100
    pub fn map<F>(self, f: F) -> Self
6✔
101
    where
102
        F: Fn(u8) -> u8,
103
    {
104
        Self::new(f(self.x), f(self.y))
12✔
105
    }
106

107
    /// Creates a vector from the elements in `if_true` and `if_false`, selecting which to use
108
    /// for each element of `self`.
109
    ///
110
    /// A true element in the mask uses the corresponding element from `if_true`, and false
111
    /// uses the element from `if_false`.
112
    #[inline]
113
    #[must_use]
114
    pub fn select(mask: BVec2, if_true: Self, if_false: Self) -> Self {
3✔
115
        Self {
116
            x: if mask.test(0) { if_true.x } else { if_false.x },
3✔
117
            y: if mask.test(1) { if_true.y } else { if_false.y },
3✔
118
        }
119
    }
120

121
    /// Creates a new vector from an array.
122
    #[inline]
123
    #[must_use]
124
    pub const fn from_array(a: [u8; 2]) -> Self {
×
125
        Self::new(a[0], a[1])
×
126
    }
127

128
    /// Converts `self` to `[x, y]`
129
    #[inline]
130
    #[must_use]
131
    pub const fn to_array(&self) -> [u8; 2] {
3✔
132
        [self.x, self.y]
3✔
133
    }
134

135
    /// Creates a vector from the first 2 values in `slice`.
136
    ///
137
    /// # Panics
138
    ///
139
    /// Panics if `slice` is less than 2 elements long.
140
    #[inline]
141
    #[must_use]
142
    pub const fn from_slice(slice: &[u8]) -> Self {
3✔
143
        assert!(slice.len() >= 2);
3✔
144
        Self::new(slice[0], slice[1])
3✔
145
    }
146

147
    /// Writes the elements of `self` to the first 2 elements in `slice`.
148
    ///
149
    /// # Panics
150
    ///
151
    /// Panics if `slice` is less than 2 elements long.
152
    #[inline]
153
    pub fn write_to_slice(self, slice: &mut [u8]) {
3✔
154
        slice[..2].copy_from_slice(&self.to_array());
3✔
155
    }
156

157
    /// Creates a 3D vector from `self` and the given `z` value.
158
    #[inline]
159
    #[must_use]
160
    pub const fn extend(self, z: u8) -> U8Vec3 {
3✔
161
        U8Vec3::new(self.x, self.y, z)
3✔
162
    }
163

164
    /// Creates a 2D vector from `self` with the given value of `x`.
165
    #[inline]
166
    #[must_use]
167
    pub fn with_x(mut self, x: u8) -> Self {
3✔
168
        self.x = x;
3✔
169
        self
3✔
170
    }
171

172
    /// Creates a 2D vector from `self` with the given value of `y`.
173
    #[inline]
174
    #[must_use]
175
    pub fn with_y(mut self, y: u8) -> Self {
3✔
176
        self.y = y;
3✔
177
        self
3✔
178
    }
179

180
    /// Computes the dot product of `self` and `rhs`.
181
    #[inline]
182
    #[must_use]
183
    pub fn dot(self, rhs: Self) -> u8 {
3✔
184
        (self.x * rhs.x) + (self.y * rhs.y)
3✔
185
    }
186

187
    /// Returns a vector where every component is the dot product of `self` and `rhs`.
188
    #[inline]
189
    #[must_use]
190
    pub fn dot_into_vec(self, rhs: Self) -> Self {
3✔
191
        Self::splat(self.dot(rhs))
3✔
192
    }
193

194
    /// Returns a vector containing the minimum values for each element of `self` and `rhs`.
195
    ///
196
    /// In other words this computes `[min(x, rhs.x), min(self.y, rhs.y), ..]`.
197
    #[inline]
198
    #[must_use]
199
    pub fn min(self, rhs: Self) -> Self {
3✔
200
        Self {
201
            x: if self.x < rhs.x { self.x } else { rhs.x },
3✔
202
            y: if self.y < rhs.y { self.y } else { rhs.y },
3✔
203
        }
204
    }
205

206
    /// Returns a vector containing the maximum values for each element of `self` and `rhs`.
207
    ///
208
    /// In other words this computes `[max(self.x, rhs.x), max(self.y, rhs.y), ..]`.
209
    #[inline]
210
    #[must_use]
211
    pub fn max(self, rhs: Self) -> Self {
3✔
212
        Self {
213
            x: if self.x > rhs.x { self.x } else { rhs.x },
3✔
214
            y: if self.y > rhs.y { self.y } else { rhs.y },
3✔
215
        }
216
    }
217

218
    /// Component-wise clamping of values, similar to [`u8::clamp`].
219
    ///
220
    /// Each element in `min` must be less-or-equal to the corresponding element in `max`.
221
    ///
222
    /// # Panics
223
    ///
224
    /// Will panic if `min` is greater than `max` when `glam_assert` is enabled.
225
    #[inline]
226
    #[must_use]
227
    pub fn clamp(self, min: Self, max: Self) -> Self {
3✔
228
        glam_assert!(min.cmple(max).all(), "clamp: expected min <= max");
3✔
229
        self.max(min).min(max)
3✔
230
    }
231

232
    /// Returns the horizontal minimum of `self`.
233
    ///
234
    /// In other words this computes `min(x, y, ..)`.
235
    #[inline]
236
    #[must_use]
237
    pub fn min_element(self) -> u8 {
3✔
238
        let min = |a, b| if a < b { a } else { b };
6✔
239
        min(self.x, self.y)
3✔
240
    }
241

242
    /// Returns the horizontal maximum of `self`.
243
    ///
244
    /// In other words this computes `max(x, y, ..)`.
245
    #[inline]
246
    #[must_use]
247
    pub fn max_element(self) -> u8 {
3✔
248
        let max = |a, b| if a > b { a } else { b };
6✔
249
        max(self.x, self.y)
3✔
250
    }
251

252
    /// Returns the index of the first minimum element of `self`.
253
    #[doc(alias = "argmin")]
254
    #[inline]
255
    #[must_use]
256
    pub fn min_position(self) -> usize {
3✔
257
        if self.x <= self.y {
6✔
258
            0
3✔
259
        } else {
260
            1
3✔
261
        }
262
    }
263

264
    /// Returns the index of the first maximum element of `self`.
265
    #[doc(alias = "argmax")]
266
    #[inline]
267
    #[must_use]
268
    pub fn max_position(self) -> usize {
3✔
269
        if self.x >= self.y {
6✔
270
            0
3✔
271
        } else {
272
            1
3✔
273
        }
274
    }
275

276
    /// Returns the sum of all elements of `self`.
277
    ///
278
    /// In other words, this computes `self.x + self.y + ..`.
279
    #[inline]
280
    #[must_use]
281
    pub fn element_sum(self) -> u8 {
3✔
282
        self.x + self.y
3✔
283
    }
284

285
    /// Returns the product of all elements of `self`.
286
    ///
287
    /// In other words, this computes `self.x * self.y * ..`.
288
    #[inline]
289
    #[must_use]
290
    pub fn element_product(self) -> u8 {
3✔
291
        self.x * self.y
3✔
292
    }
293

294
    /// Returns a vector mask containing the result of a `==` comparison for each element of
295
    /// `self` and `rhs`.
296
    ///
297
    /// In other words, this computes `[self.x == rhs.x, self.y == rhs.y, ..]` for all
298
    /// elements.
299
    #[inline]
300
    #[must_use]
301
    pub fn cmpeq(self, rhs: Self) -> BVec2 {
3✔
302
        BVec2::new(self.x.eq(&rhs.x), self.y.eq(&rhs.y))
3✔
303
    }
304

305
    /// Returns a vector mask containing the result of a `!=` comparison for each element of
306
    /// `self` and `rhs`.
307
    ///
308
    /// In other words this computes `[self.x != rhs.x, self.y != rhs.y, ..]` for all
309
    /// elements.
310
    #[inline]
311
    #[must_use]
312
    pub fn cmpne(self, rhs: Self) -> BVec2 {
3✔
313
        BVec2::new(self.x.ne(&rhs.x), self.y.ne(&rhs.y))
3✔
314
    }
315

316
    /// Returns a vector mask containing the result of a `>=` comparison for each element of
317
    /// `self` and `rhs`.
318
    ///
319
    /// In other words this computes `[self.x >= rhs.x, self.y >= rhs.y, ..]` for all
320
    /// elements.
321
    #[inline]
322
    #[must_use]
323
    pub fn cmpge(self, rhs: Self) -> BVec2 {
3✔
324
        BVec2::new(self.x.ge(&rhs.x), self.y.ge(&rhs.y))
3✔
325
    }
326

327
    /// Returns a vector mask containing the result of a `>` comparison for each element of
328
    /// `self` and `rhs`.
329
    ///
330
    /// In other words this computes `[self.x > rhs.x, self.y > rhs.y, ..]` for all
331
    /// elements.
332
    #[inline]
333
    #[must_use]
334
    pub fn cmpgt(self, rhs: Self) -> BVec2 {
3✔
335
        BVec2::new(self.x.gt(&rhs.x), self.y.gt(&rhs.y))
3✔
336
    }
337

338
    /// Returns a vector mask containing the result of a `<=` comparison for each element of
339
    /// `self` and `rhs`.
340
    ///
341
    /// In other words this computes `[self.x <= rhs.x, self.y <= rhs.y, ..]` for all
342
    /// elements.
343
    #[inline]
344
    #[must_use]
345
    pub fn cmple(self, rhs: Self) -> BVec2 {
6✔
346
        BVec2::new(self.x.le(&rhs.x), self.y.le(&rhs.y))
6✔
347
    }
348

349
    /// Returns a vector mask containing the result of a `<` comparison for each element of
350
    /// `self` and `rhs`.
351
    ///
352
    /// In other words this computes `[self.x < rhs.x, self.y < rhs.y, ..]` for all
353
    /// elements.
354
    #[inline]
355
    #[must_use]
356
    pub fn cmplt(self, rhs: Self) -> BVec2 {
3✔
357
        BVec2::new(self.x.lt(&rhs.x), self.y.lt(&rhs.y))
3✔
358
    }
359

360
    /// Computes the squared length of `self`.
361
    #[doc(alias = "magnitude2")]
362
    #[inline]
363
    #[must_use]
364
    pub fn length_squared(self) -> u8 {
3✔
365
        self.dot(self)
3✔
366
    }
367

368
    /// Computes the [manhattan distance] between two points.
369
    ///
370
    /// # Overflow
371
    /// This method may overflow if the result is greater than [`u8::MAX`].
372
    ///
373
    /// See also [`checked_manhattan_distance`][U8Vec2::checked_manhattan_distance].
374
    ///
375
    /// [manhattan distance]: https://en.wikipedia.org/wiki/Taxicab_geometry
376
    #[inline]
377
    #[must_use]
378
    pub fn manhattan_distance(self, rhs: Self) -> u8 {
3✔
379
        self.x.abs_diff(rhs.x) + self.y.abs_diff(rhs.y)
3✔
380
    }
381

382
    /// Computes the [manhattan distance] between two points.
383
    ///
384
    /// This will returns [`None`] if the result is greater than [`u8::MAX`].
385
    ///
386
    /// [manhattan distance]: https://en.wikipedia.org/wiki/Taxicab_geometry
387
    #[inline]
388
    #[must_use]
389
    pub fn checked_manhattan_distance(self, rhs: Self) -> Option<u8> {
3✔
390
        let d = self.x.abs_diff(rhs.x);
3✔
391
        d.checked_add(self.y.abs_diff(rhs.y))
3✔
392
    }
393

394
    /// Computes the [chebyshev distance] between two points.
395
    ///
396
    /// [chebyshev distance]: https://en.wikipedia.org/wiki/Chebyshev_distance
397
    #[inline]
398
    #[must_use]
399
    pub fn chebyshev_distance(self, rhs: Self) -> u8 {
3✔
400
        // Note: the compiler will eventually optimize out the loop
401
        [self.x.abs_diff(rhs.x), self.y.abs_diff(rhs.y)]
3✔
402
            .into_iter()
403
            .max()
404
            .unwrap()
405
    }
406

407
    /// Casts all elements of `self` to `f32`.
408
    #[inline]
409
    #[must_use]
410
    pub fn as_vec2(self) -> crate::Vec2 {
3✔
411
        crate::Vec2::new(self.x as f32, self.y as f32)
3✔
412
    }
413

414
    /// Casts all elements of `self` to `f64`.
415
    #[cfg(feature = "f64")]
416
    #[inline]
417
    #[must_use]
418
    pub fn as_dvec2(self) -> crate::DVec2 {
3✔
419
        crate::DVec2::new(self.x as f64, self.y as f64)
3✔
420
    }
421

422
    /// Casts all elements of `self` to `i8`.
423
    #[cfg(feature = "i8")]
424
    #[inline]
425
    #[must_use]
426
    pub fn as_i8vec2(self) -> crate::I8Vec2 {
3✔
427
        crate::I8Vec2::new(self.x as i8, self.y as i8)
3✔
428
    }
429

430
    /// Casts all elements of `self` to `i16`.
431
    #[cfg(feature = "i16")]
432
    #[inline]
433
    #[must_use]
434
    pub fn as_i16vec2(self) -> crate::I16Vec2 {
3✔
435
        crate::I16Vec2::new(self.x as i16, self.y as i16)
3✔
436
    }
437

438
    /// Casts all elements of `self` to `u16`.
439
    #[cfg(feature = "u16")]
440
    #[inline]
441
    #[must_use]
442
    pub fn as_u16vec2(self) -> crate::U16Vec2 {
3✔
443
        crate::U16Vec2::new(self.x as u16, self.y as u16)
3✔
444
    }
445

446
    /// Casts all elements of `self` to `i32`.
447
    #[cfg(feature = "i32")]
448
    #[inline]
449
    #[must_use]
450
    pub fn as_ivec2(self) -> crate::IVec2 {
3✔
451
        crate::IVec2::new(self.x as i32, self.y as i32)
3✔
452
    }
453

454
    /// Casts all elements of `self` to `u32`.
455
    #[cfg(feature = "u32")]
456
    #[inline]
457
    #[must_use]
458
    pub fn as_uvec2(self) -> crate::UVec2 {
3✔
459
        crate::UVec2::new(self.x as u32, self.y as u32)
3✔
460
    }
461

462
    /// Casts all elements of `self` to `i64`.
463
    #[cfg(feature = "i64")]
464
    #[inline]
465
    #[must_use]
466
    pub fn as_i64vec2(self) -> crate::I64Vec2 {
3✔
467
        crate::I64Vec2::new(self.x as i64, self.y as i64)
3✔
468
    }
469

470
    /// Casts all elements of `self` to `u64`.
471
    #[cfg(feature = "u64")]
472
    #[inline]
473
    #[must_use]
474
    pub fn as_u64vec2(self) -> crate::U64Vec2 {
3✔
475
        crate::U64Vec2::new(self.x as u64, self.y as u64)
3✔
476
    }
477

478
    /// Casts all elements of `self` to `isize`.
479
    #[cfg(feature = "isize")]
480
    #[inline]
481
    #[must_use]
482
    pub fn as_isizevec2(self) -> crate::ISizeVec2 {
3✔
483
        crate::ISizeVec2::new(self.x as isize, self.y as isize)
3✔
484
    }
485

486
    /// Casts all elements of `self` to `usize`.
487
    #[cfg(feature = "usize")]
488
    #[inline]
489
    #[must_use]
490
    pub fn as_usizevec2(self) -> crate::USizeVec2 {
3✔
491
        crate::USizeVec2::new(self.x as usize, self.y as usize)
3✔
492
    }
493

494
    /// Returns a vector containing the wrapping addition of `self` and `rhs`.
495
    ///
496
    /// In other words this computes `Some([self.x + rhs.x, self.y + rhs.y, ..])` but returns `None` on any overflow.
497
    #[inline]
498
    #[must_use]
499
    pub const fn checked_add(self, rhs: Self) -> Option<Self> {
3✔
500
        let x = match self.x.checked_add(rhs.x) {
3✔
501
            Some(v) => v,
3✔
502
            None => return None,
3✔
503
        };
504
        let y = match self.y.checked_add(rhs.y) {
3✔
505
            Some(v) => v,
3✔
506
            None => return None,
3✔
507
        };
508

509
        Some(Self { x, y })
3✔
510
    }
511

512
    /// Returns a vector containing the wrapping subtraction of `self` and `rhs`.
513
    ///
514
    /// In other words this computes `Some([self.x - rhs.x, self.y - rhs.y, ..])` but returns `None` on any overflow.
515
    #[inline]
516
    #[must_use]
517
    pub const fn checked_sub(self, rhs: Self) -> Option<Self> {
3✔
518
        let x = match self.x.checked_sub(rhs.x) {
3✔
519
            Some(v) => v,
3✔
520
            None => return None,
3✔
521
        };
522
        let y = match self.y.checked_sub(rhs.y) {
3✔
523
            Some(v) => v,
3✔
524
            None => return None,
3✔
525
        };
526

527
        Some(Self { x, y })
3✔
528
    }
529

530
    /// Returns a vector containing the wrapping multiplication of `self` and `rhs`.
531
    ///
532
    /// In other words this computes `Some([self.x * rhs.x, self.y * rhs.y, ..])` but returns `None` on any overflow.
533
    #[inline]
534
    #[must_use]
535
    pub const fn checked_mul(self, rhs: Self) -> Option<Self> {
3✔
536
        let x = match self.x.checked_mul(rhs.x) {
3✔
537
            Some(v) => v,
3✔
538
            None => return None,
3✔
539
        };
540
        let y = match self.y.checked_mul(rhs.y) {
3✔
541
            Some(v) => v,
3✔
542
            None => return None,
×
543
        };
544

545
        Some(Self { x, y })
3✔
546
    }
547

548
    /// Returns a vector containing the wrapping division of `self` and `rhs`.
549
    ///
550
    /// In other words this computes `Some([self.x / rhs.x, self.y / rhs.y, ..])` but returns `None` on any division by zero.
551
    #[inline]
552
    #[must_use]
553
    pub const fn checked_div(self, rhs: Self) -> Option<Self> {
3✔
554
        let x = match self.x.checked_div(rhs.x) {
3✔
555
            Some(v) => v,
3✔
556
            None => return None,
3✔
557
        };
558
        let y = match self.y.checked_div(rhs.y) {
3✔
559
            Some(v) => v,
3✔
560
            None => return None,
3✔
561
        };
562

563
        Some(Self { x, y })
3✔
564
    }
565

566
    /// Returns a vector containing the wrapping addition of `self` and `rhs`.
567
    ///
568
    /// In other words this computes `[self.x.wrapping_add(rhs.x), self.y.wrapping_add(rhs.y), ..]`.
569
    #[inline]
570
    #[must_use]
571
    pub const fn wrapping_add(self, rhs: Self) -> Self {
3✔
572
        Self {
573
            x: self.x.wrapping_add(rhs.x),
3✔
574
            y: self.y.wrapping_add(rhs.y),
3✔
575
        }
576
    }
577

578
    /// Returns a vector containing the wrapping subtraction of `self` and `rhs`.
579
    ///
580
    /// In other words this computes `[self.x.wrapping_sub(rhs.x), self.y.wrapping_sub(rhs.y), ..]`.
581
    #[inline]
582
    #[must_use]
583
    pub const fn wrapping_sub(self, rhs: Self) -> Self {
3✔
584
        Self {
585
            x: self.x.wrapping_sub(rhs.x),
3✔
586
            y: self.y.wrapping_sub(rhs.y),
3✔
587
        }
588
    }
589

590
    /// Returns a vector containing the wrapping multiplication of `self` and `rhs`.
591
    ///
592
    /// In other words this computes `[self.x.wrapping_mul(rhs.x), self.y.wrapping_mul(rhs.y), ..]`.
593
    #[inline]
594
    #[must_use]
595
    pub const fn wrapping_mul(self, rhs: Self) -> Self {
3✔
596
        Self {
597
            x: self.x.wrapping_mul(rhs.x),
3✔
598
            y: self.y.wrapping_mul(rhs.y),
3✔
599
        }
600
    }
601

602
    /// Returns a vector containing the wrapping division of `self` and `rhs`.
603
    ///
604
    /// In other words this computes `[self.x.wrapping_div(rhs.x), self.y.wrapping_div(rhs.y), ..]`.
605
    #[inline]
606
    #[must_use]
607
    pub const fn wrapping_div(self, rhs: Self) -> Self {
3✔
608
        Self {
609
            x: self.x.wrapping_div(rhs.x),
3✔
610
            y: self.y.wrapping_div(rhs.y),
3✔
611
        }
612
    }
613

614
    /// Returns a vector containing the saturating addition of `self` and `rhs`.
615
    ///
616
    /// In other words this computes `[self.x.saturating_add(rhs.x), self.y.saturating_add(rhs.y), ..]`.
617
    #[inline]
618
    #[must_use]
619
    pub const fn saturating_add(self, rhs: Self) -> Self {
3✔
620
        Self {
621
            x: self.x.saturating_add(rhs.x),
3✔
622
            y: self.y.saturating_add(rhs.y),
3✔
623
        }
624
    }
625

626
    /// Returns a vector containing the saturating subtraction of `self` and `rhs`.
627
    ///
628
    /// In other words this computes `[self.x.saturating_sub(rhs.x), self.y.saturating_sub(rhs.y), ..]`.
629
    #[inline]
630
    #[must_use]
631
    pub const fn saturating_sub(self, rhs: Self) -> Self {
3✔
632
        Self {
633
            x: self.x.saturating_sub(rhs.x),
3✔
634
            y: self.y.saturating_sub(rhs.y),
3✔
635
        }
636
    }
637

638
    /// Returns a vector containing the saturating multiplication of `self` and `rhs`.
639
    ///
640
    /// In other words this computes `[self.x.saturating_mul(rhs.x), self.y.saturating_mul(rhs.y), ..]`.
641
    #[inline]
642
    #[must_use]
643
    pub const fn saturating_mul(self, rhs: Self) -> Self {
3✔
644
        Self {
645
            x: self.x.saturating_mul(rhs.x),
3✔
646
            y: self.y.saturating_mul(rhs.y),
3✔
647
        }
648
    }
649

650
    /// Returns a vector containing the saturating division of `self` and `rhs`.
651
    ///
652
    /// In other words this computes `[self.x.saturating_div(rhs.x), self.y.saturating_div(rhs.y), ..]`.
653
    #[inline]
654
    #[must_use]
655
    pub const fn saturating_div(self, rhs: Self) -> Self {
3✔
656
        Self {
657
            x: self.x.saturating_div(rhs.x),
3✔
658
            y: self.y.saturating_div(rhs.y),
3✔
659
        }
660
    }
661

662
    /// Returns a vector containing the wrapping addition of `self` and signed vector `rhs`.
663
    ///
664
    /// In other words this computes `Some([self.x + rhs.x, self.y + rhs.y, ..])` but returns `None` on any overflow.
665

666
    #[cfg(feature = "i8")]
667
    #[inline]
668
    #[must_use]
669
    pub const fn checked_add_signed(self, rhs: I8Vec2) -> Option<Self> {
3✔
670
        let x = match self.x.checked_add_signed(rhs.x) {
3✔
671
            Some(v) => v,
3✔
672
            None => return None,
3✔
673
        };
674
        let y = match self.y.checked_add_signed(rhs.y) {
3✔
675
            Some(v) => v,
3✔
676
            None => return None,
×
677
        };
678

679
        Some(Self { x, y })
3✔
680
    }
681

682
    /// Returns a vector containing the wrapping addition of `self` and signed vector `rhs`.
683
    ///
684
    /// In other words this computes `[self.x.wrapping_add_signed(rhs.x), self.y.wrapping_add_signed(rhs.y), ..]`.
685

686
    #[cfg(feature = "i8")]
687
    #[inline]
688
    #[must_use]
689
    pub const fn wrapping_add_signed(self, rhs: I8Vec2) -> Self {
3✔
690
        Self {
691
            x: self.x.wrapping_add_signed(rhs.x),
3✔
692
            y: self.y.wrapping_add_signed(rhs.y),
3✔
693
        }
694
    }
695

696
    /// Returns a vector containing the saturating addition of `self` and signed vector `rhs`.
697
    ///
698
    /// In other words this computes `[self.x.saturating_add_signed(rhs.x), self.y.saturating_add_signed(rhs.y), ..]`.
699

700
    #[cfg(feature = "i8")]
701
    #[inline]
702
    #[must_use]
703
    pub const fn saturating_add_signed(self, rhs: I8Vec2) -> Self {
3✔
704
        Self {
705
            x: self.x.saturating_add_signed(rhs.x),
3✔
706
            y: self.y.saturating_add_signed(rhs.y),
3✔
707
        }
708
    }
709
}
710

711
impl Default for U8Vec2 {
712
    #[inline(always)]
713
    fn default() -> Self {
6✔
714
        Self::ZERO
×
715
    }
716
}
717

718
impl Div for U8Vec2 {
719
    type Output = Self;
720
    #[inline]
721
    fn div(self, rhs: Self) -> Self {
3✔
722
        Self {
723
            x: self.x.div(rhs.x),
3✔
724
            y: self.y.div(rhs.y),
3✔
725
        }
726
    }
727
}
728

729
impl Div<&Self> for U8Vec2 {
730
    type Output = Self;
731
    #[inline]
732
    fn div(self, rhs: &Self) -> Self {
3✔
733
        self.div(*rhs)
3✔
734
    }
735
}
736

737
impl Div<&U8Vec2> for &U8Vec2 {
738
    type Output = U8Vec2;
739
    #[inline]
740
    fn div(self, rhs: &U8Vec2) -> U8Vec2 {
3✔
741
        (*self).div(*rhs)
3✔
742
    }
743
}
744

745
impl Div<U8Vec2> for &U8Vec2 {
746
    type Output = U8Vec2;
747
    #[inline]
748
    fn div(self, rhs: U8Vec2) -> U8Vec2 {
3✔
749
        (*self).div(rhs)
3✔
750
    }
751
}
752

753
impl DivAssign for U8Vec2 {
754
    #[inline]
755
    fn div_assign(&mut self, rhs: Self) {
3✔
756
        self.x.div_assign(rhs.x);
3✔
757
        self.y.div_assign(rhs.y);
4✔
758
    }
759
}
760

761
impl DivAssign<&Self> for U8Vec2 {
762
    #[inline]
763
    fn div_assign(&mut self, rhs: &Self) {
3✔
764
        self.div_assign(*rhs);
3✔
765
    }
766
}
767

768
impl Div<u8> for U8Vec2 {
769
    type Output = Self;
770
    #[inline]
771
    fn div(self, rhs: u8) -> Self {
6✔
772
        Self {
773
            x: self.x.div(rhs),
6✔
774
            y: self.y.div(rhs),
6✔
775
        }
776
    }
777
}
778

779
impl Div<&u8> for U8Vec2 {
780
    type Output = Self;
781
    #[inline]
782
    fn div(self, rhs: &u8) -> Self {
3✔
783
        self.div(*rhs)
3✔
784
    }
785
}
786

787
impl Div<&u8> for &U8Vec2 {
788
    type Output = U8Vec2;
789
    #[inline]
790
    fn div(self, rhs: &u8) -> U8Vec2 {
3✔
791
        (*self).div(*rhs)
3✔
792
    }
793
}
794

795
impl Div<u8> for &U8Vec2 {
796
    type Output = U8Vec2;
797
    #[inline]
798
    fn div(self, rhs: u8) -> U8Vec2 {
3✔
799
        (*self).div(rhs)
3✔
800
    }
801
}
802

803
impl DivAssign<u8> for U8Vec2 {
804
    #[inline]
805
    fn div_assign(&mut self, rhs: u8) {
3✔
806
        self.x.div_assign(rhs);
3✔
807
        self.y.div_assign(rhs);
4✔
808
    }
809
}
810

811
impl DivAssign<&u8> for U8Vec2 {
812
    #[inline]
813
    fn div_assign(&mut self, rhs: &u8) {
3✔
814
        self.div_assign(*rhs);
3✔
815
    }
816
}
817

818
impl Div<U8Vec2> for u8 {
819
    type Output = U8Vec2;
820
    #[inline]
821
    fn div(self, rhs: U8Vec2) -> U8Vec2 {
3✔
822
        U8Vec2 {
823
            x: self.div(rhs.x),
3✔
824
            y: self.div(rhs.y),
3✔
825
        }
826
    }
827
}
828

829
impl Div<&U8Vec2> for u8 {
830
    type Output = U8Vec2;
831
    #[inline]
832
    fn div(self, rhs: &U8Vec2) -> U8Vec2 {
3✔
833
        self.div(*rhs)
3✔
834
    }
835
}
836

837
impl Div<&U8Vec2> for &u8 {
838
    type Output = U8Vec2;
839
    #[inline]
840
    fn div(self, rhs: &U8Vec2) -> U8Vec2 {
3✔
841
        (*self).div(*rhs)
3✔
842
    }
843
}
844

845
impl Div<U8Vec2> for &u8 {
846
    type Output = U8Vec2;
847
    #[inline]
848
    fn div(self, rhs: U8Vec2) -> U8Vec2 {
3✔
849
        (*self).div(rhs)
3✔
850
    }
851
}
852

853
impl Mul for U8Vec2 {
854
    type Output = Self;
855
    #[inline]
856
    fn mul(self, rhs: Self) -> Self {
3✔
857
        Self {
858
            x: self.x.mul(rhs.x),
4✔
859
            y: self.y.mul(rhs.y),
5✔
860
        }
861
    }
862
}
863

864
impl Mul<&Self> for U8Vec2 {
865
    type Output = Self;
866
    #[inline]
867
    fn mul(self, rhs: &Self) -> Self {
3✔
868
        self.mul(*rhs)
3✔
869
    }
870
}
871

872
impl Mul<&U8Vec2> for &U8Vec2 {
873
    type Output = U8Vec2;
874
    #[inline]
875
    fn mul(self, rhs: &U8Vec2) -> U8Vec2 {
3✔
876
        (*self).mul(*rhs)
3✔
877
    }
878
}
879

880
impl Mul<U8Vec2> for &U8Vec2 {
881
    type Output = U8Vec2;
882
    #[inline]
883
    fn mul(self, rhs: U8Vec2) -> U8Vec2 {
3✔
884
        (*self).mul(rhs)
3✔
885
    }
886
}
887

888
impl MulAssign for U8Vec2 {
889
    #[inline]
890
    fn mul_assign(&mut self, rhs: Self) {
3✔
891
        self.x.mul_assign(rhs.x);
3✔
892
        self.y.mul_assign(rhs.y);
4✔
893
    }
894
}
895

896
impl MulAssign<&Self> for U8Vec2 {
897
    #[inline]
898
    fn mul_assign(&mut self, rhs: &Self) {
3✔
899
        self.mul_assign(*rhs);
3✔
900
    }
901
}
902

903
impl Mul<u8> for U8Vec2 {
904
    type Output = Self;
905
    #[inline]
906
    fn mul(self, rhs: u8) -> Self {
3✔
907
        Self {
908
            x: self.x.mul(rhs),
3✔
909
            y: self.y.mul(rhs),
3✔
910
        }
911
    }
912
}
913

914
impl Mul<&u8> for U8Vec2 {
915
    type Output = Self;
916
    #[inline]
917
    fn mul(self, rhs: &u8) -> Self {
3✔
918
        self.mul(*rhs)
3✔
919
    }
920
}
921

922
impl Mul<&u8> for &U8Vec2 {
923
    type Output = U8Vec2;
924
    #[inline]
925
    fn mul(self, rhs: &u8) -> U8Vec2 {
3✔
926
        (*self).mul(*rhs)
3✔
927
    }
928
}
929

930
impl Mul<u8> for &U8Vec2 {
931
    type Output = U8Vec2;
932
    #[inline]
933
    fn mul(self, rhs: u8) -> U8Vec2 {
3✔
934
        (*self).mul(rhs)
3✔
935
    }
936
}
937

938
impl MulAssign<u8> for U8Vec2 {
939
    #[inline]
940
    fn mul_assign(&mut self, rhs: u8) {
3✔
941
        self.x.mul_assign(rhs);
3✔
942
        self.y.mul_assign(rhs);
4✔
943
    }
944
}
945

946
impl MulAssign<&u8> for U8Vec2 {
947
    #[inline]
948
    fn mul_assign(&mut self, rhs: &u8) {
3✔
949
        self.mul_assign(*rhs);
3✔
950
    }
951
}
952

953
impl Mul<U8Vec2> for u8 {
954
    type Output = U8Vec2;
955
    #[inline]
956
    fn mul(self, rhs: U8Vec2) -> U8Vec2 {
3✔
957
        U8Vec2 {
958
            x: self.mul(rhs.x),
3✔
959
            y: self.mul(rhs.y),
3✔
960
        }
961
    }
962
}
963

964
impl Mul<&U8Vec2> for u8 {
965
    type Output = U8Vec2;
966
    #[inline]
967
    fn mul(self, rhs: &U8Vec2) -> U8Vec2 {
3✔
968
        self.mul(*rhs)
3✔
969
    }
970
}
971

972
impl Mul<&U8Vec2> for &u8 {
973
    type Output = U8Vec2;
974
    #[inline]
975
    fn mul(self, rhs: &U8Vec2) -> U8Vec2 {
3✔
976
        (*self).mul(*rhs)
3✔
977
    }
978
}
979

980
impl Mul<U8Vec2> for &u8 {
981
    type Output = U8Vec2;
982
    #[inline]
983
    fn mul(self, rhs: U8Vec2) -> U8Vec2 {
3✔
984
        (*self).mul(rhs)
3✔
985
    }
986
}
987

988
impl Add for U8Vec2 {
989
    type Output = Self;
990
    #[inline]
991
    fn add(self, rhs: Self) -> Self {
3✔
992
        Self {
993
            x: self.x.add(rhs.x),
3✔
994
            y: self.y.add(rhs.y),
3✔
995
        }
996
    }
997
}
998

999
impl Add<&Self> for U8Vec2 {
1000
    type Output = Self;
1001
    #[inline]
1002
    fn add(self, rhs: &Self) -> Self {
3✔
1003
        self.add(*rhs)
3✔
1004
    }
1005
}
1006

1007
impl Add<&U8Vec2> for &U8Vec2 {
1008
    type Output = U8Vec2;
1009
    #[inline]
1010
    fn add(self, rhs: &U8Vec2) -> U8Vec2 {
3✔
1011
        (*self).add(*rhs)
3✔
1012
    }
1013
}
1014

1015
impl Add<U8Vec2> for &U8Vec2 {
1016
    type Output = U8Vec2;
1017
    #[inline]
1018
    fn add(self, rhs: U8Vec2) -> U8Vec2 {
3✔
1019
        (*self).add(rhs)
3✔
1020
    }
1021
}
1022

1023
impl AddAssign for U8Vec2 {
1024
    #[inline]
1025
    fn add_assign(&mut self, rhs: Self) {
3✔
1026
        self.x.add_assign(rhs.x);
3✔
1027
        self.y.add_assign(rhs.y);
4✔
1028
    }
1029
}
1030

1031
impl AddAssign<&Self> for U8Vec2 {
1032
    #[inline]
1033
    fn add_assign(&mut self, rhs: &Self) {
3✔
1034
        self.add_assign(*rhs);
3✔
1035
    }
1036
}
1037

1038
impl Add<u8> for U8Vec2 {
1039
    type Output = Self;
1040
    #[inline]
1041
    fn add(self, rhs: u8) -> Self {
3✔
1042
        Self {
1043
            x: self.x.add(rhs),
3✔
1044
            y: self.y.add(rhs),
3✔
1045
        }
1046
    }
1047
}
1048

1049
impl Add<&u8> for U8Vec2 {
1050
    type Output = Self;
1051
    #[inline]
1052
    fn add(self, rhs: &u8) -> Self {
3✔
1053
        self.add(*rhs)
3✔
1054
    }
1055
}
1056

1057
impl Add<&u8> for &U8Vec2 {
1058
    type Output = U8Vec2;
1059
    #[inline]
1060
    fn add(self, rhs: &u8) -> U8Vec2 {
3✔
1061
        (*self).add(*rhs)
3✔
1062
    }
1063
}
1064

1065
impl Add<u8> for &U8Vec2 {
1066
    type Output = U8Vec2;
1067
    #[inline]
1068
    fn add(self, rhs: u8) -> U8Vec2 {
3✔
1069
        (*self).add(rhs)
3✔
1070
    }
1071
}
1072

1073
impl AddAssign<u8> for U8Vec2 {
1074
    #[inline]
1075
    fn add_assign(&mut self, rhs: u8) {
3✔
1076
        self.x.add_assign(rhs);
3✔
1077
        self.y.add_assign(rhs);
3✔
1078
    }
1079
}
1080

1081
impl AddAssign<&u8> for U8Vec2 {
1082
    #[inline]
1083
    fn add_assign(&mut self, rhs: &u8) {
3✔
1084
        self.add_assign(*rhs);
3✔
1085
    }
1086
}
1087

1088
impl Add<U8Vec2> for u8 {
1089
    type Output = U8Vec2;
1090
    #[inline]
1091
    fn add(self, rhs: U8Vec2) -> U8Vec2 {
3✔
1092
        U8Vec2 {
1093
            x: self.add(rhs.x),
3✔
1094
            y: self.add(rhs.y),
3✔
1095
        }
1096
    }
1097
}
1098

1099
impl Add<&U8Vec2> for u8 {
1100
    type Output = U8Vec2;
1101
    #[inline]
1102
    fn add(self, rhs: &U8Vec2) -> U8Vec2 {
3✔
1103
        self.add(*rhs)
3✔
1104
    }
1105
}
1106

1107
impl Add<&U8Vec2> for &u8 {
1108
    type Output = U8Vec2;
1109
    #[inline]
1110
    fn add(self, rhs: &U8Vec2) -> U8Vec2 {
3✔
1111
        (*self).add(*rhs)
3✔
1112
    }
1113
}
1114

1115
impl Add<U8Vec2> for &u8 {
1116
    type Output = U8Vec2;
1117
    #[inline]
1118
    fn add(self, rhs: U8Vec2) -> U8Vec2 {
3✔
1119
        (*self).add(rhs)
3✔
1120
    }
1121
}
1122

1123
impl Sub for U8Vec2 {
1124
    type Output = Self;
1125
    #[inline]
1126
    fn sub(self, rhs: Self) -> Self {
3✔
1127
        Self {
1128
            x: self.x.sub(rhs.x),
3✔
1129
            y: self.y.sub(rhs.y),
3✔
1130
        }
1131
    }
1132
}
1133

1134
impl Sub<&Self> for U8Vec2 {
1135
    type Output = Self;
1136
    #[inline]
1137
    fn sub(self, rhs: &Self) -> Self {
3✔
1138
        self.sub(*rhs)
3✔
1139
    }
1140
}
1141

1142
impl Sub<&U8Vec2> for &U8Vec2 {
1143
    type Output = U8Vec2;
1144
    #[inline]
1145
    fn sub(self, rhs: &U8Vec2) -> U8Vec2 {
3✔
1146
        (*self).sub(*rhs)
3✔
1147
    }
1148
}
1149

1150
impl Sub<U8Vec2> for &U8Vec2 {
1151
    type Output = U8Vec2;
1152
    #[inline]
1153
    fn sub(self, rhs: U8Vec2) -> U8Vec2 {
3✔
1154
        (*self).sub(rhs)
3✔
1155
    }
1156
}
1157

1158
impl SubAssign for U8Vec2 {
1159
    #[inline]
1160
    fn sub_assign(&mut self, rhs: Self) {
3✔
1161
        self.x.sub_assign(rhs.x);
3✔
1162
        self.y.sub_assign(rhs.y);
4✔
1163
    }
1164
}
1165

1166
impl SubAssign<&Self> for U8Vec2 {
1167
    #[inline]
1168
    fn sub_assign(&mut self, rhs: &Self) {
3✔
1169
        self.sub_assign(*rhs);
3✔
1170
    }
1171
}
1172

1173
impl Sub<u8> for U8Vec2 {
1174
    type Output = Self;
1175
    #[inline]
1176
    fn sub(self, rhs: u8) -> Self {
3✔
1177
        Self {
1178
            x: self.x.sub(rhs),
3✔
1179
            y: self.y.sub(rhs),
4✔
1180
        }
1181
    }
1182
}
1183

1184
impl Sub<&u8> for U8Vec2 {
1185
    type Output = Self;
1186
    #[inline]
1187
    fn sub(self, rhs: &u8) -> Self {
3✔
1188
        self.sub(*rhs)
3✔
1189
    }
1190
}
1191

1192
impl Sub<&u8> for &U8Vec2 {
1193
    type Output = U8Vec2;
1194
    #[inline]
1195
    fn sub(self, rhs: &u8) -> U8Vec2 {
3✔
1196
        (*self).sub(*rhs)
3✔
1197
    }
1198
}
1199

1200
impl Sub<u8> for &U8Vec2 {
1201
    type Output = U8Vec2;
1202
    #[inline]
1203
    fn sub(self, rhs: u8) -> U8Vec2 {
3✔
1204
        (*self).sub(rhs)
3✔
1205
    }
1206
}
1207

1208
impl SubAssign<u8> for U8Vec2 {
1209
    #[inline]
1210
    fn sub_assign(&mut self, rhs: u8) {
3✔
1211
        self.x.sub_assign(rhs);
3✔
1212
        self.y.sub_assign(rhs);
3✔
1213
    }
1214
}
1215

1216
impl SubAssign<&u8> for U8Vec2 {
1217
    #[inline]
1218
    fn sub_assign(&mut self, rhs: &u8) {
3✔
1219
        self.sub_assign(*rhs);
3✔
1220
    }
1221
}
1222

1223
impl Sub<U8Vec2> for u8 {
1224
    type Output = U8Vec2;
1225
    #[inline]
1226
    fn sub(self, rhs: U8Vec2) -> U8Vec2 {
3✔
1227
        U8Vec2 {
1228
            x: self.sub(rhs.x),
3✔
1229
            y: self.sub(rhs.y),
3✔
1230
        }
1231
    }
1232
}
1233

1234
impl Sub<&U8Vec2> for u8 {
1235
    type Output = U8Vec2;
1236
    #[inline]
1237
    fn sub(self, rhs: &U8Vec2) -> U8Vec2 {
3✔
1238
        self.sub(*rhs)
3✔
1239
    }
1240
}
1241

1242
impl Sub<&U8Vec2> for &u8 {
1243
    type Output = U8Vec2;
1244
    #[inline]
1245
    fn sub(self, rhs: &U8Vec2) -> U8Vec2 {
3✔
1246
        (*self).sub(*rhs)
3✔
1247
    }
1248
}
1249

1250
impl Sub<U8Vec2> for &u8 {
1251
    type Output = U8Vec2;
1252
    #[inline]
1253
    fn sub(self, rhs: U8Vec2) -> U8Vec2 {
3✔
1254
        (*self).sub(rhs)
3✔
1255
    }
1256
}
1257

1258
impl Rem for U8Vec2 {
1259
    type Output = Self;
1260
    #[inline]
1261
    fn rem(self, rhs: Self) -> Self {
3✔
1262
        Self {
1263
            x: self.x.rem(rhs.x),
3✔
1264
            y: self.y.rem(rhs.y),
3✔
1265
        }
1266
    }
1267
}
1268

1269
impl Rem<&Self> for U8Vec2 {
1270
    type Output = Self;
1271
    #[inline]
1272
    fn rem(self, rhs: &Self) -> Self {
3✔
1273
        self.rem(*rhs)
3✔
1274
    }
1275
}
1276

1277
impl Rem<&U8Vec2> for &U8Vec2 {
1278
    type Output = U8Vec2;
1279
    #[inline]
1280
    fn rem(self, rhs: &U8Vec2) -> U8Vec2 {
3✔
1281
        (*self).rem(*rhs)
3✔
1282
    }
1283
}
1284

1285
impl Rem<U8Vec2> for &U8Vec2 {
1286
    type Output = U8Vec2;
1287
    #[inline]
1288
    fn rem(self, rhs: U8Vec2) -> U8Vec2 {
3✔
1289
        (*self).rem(rhs)
3✔
1290
    }
1291
}
1292

1293
impl RemAssign for U8Vec2 {
1294
    #[inline]
1295
    fn rem_assign(&mut self, rhs: Self) {
3✔
1296
        self.x.rem_assign(rhs.x);
4✔
1297
        self.y.rem_assign(rhs.y);
4✔
1298
    }
1299
}
1300

1301
impl RemAssign<&Self> for U8Vec2 {
1302
    #[inline]
1303
    fn rem_assign(&mut self, rhs: &Self) {
3✔
1304
        self.rem_assign(*rhs);
3✔
1305
    }
1306
}
1307

1308
impl Rem<u8> for U8Vec2 {
1309
    type Output = Self;
1310
    #[inline]
1311
    fn rem(self, rhs: u8) -> Self {
3✔
1312
        Self {
1313
            x: self.x.rem(rhs),
3✔
1314
            y: self.y.rem(rhs),
3✔
1315
        }
1316
    }
1317
}
1318

1319
impl Rem<&u8> for U8Vec2 {
1320
    type Output = Self;
1321
    #[inline]
1322
    fn rem(self, rhs: &u8) -> Self {
3✔
1323
        self.rem(*rhs)
3✔
1324
    }
1325
}
1326

1327
impl Rem<&u8> for &U8Vec2 {
1328
    type Output = U8Vec2;
1329
    #[inline]
1330
    fn rem(self, rhs: &u8) -> U8Vec2 {
3✔
1331
        (*self).rem(*rhs)
3✔
1332
    }
1333
}
1334

1335
impl Rem<u8> for &U8Vec2 {
1336
    type Output = U8Vec2;
1337
    #[inline]
1338
    fn rem(self, rhs: u8) -> U8Vec2 {
3✔
1339
        (*self).rem(rhs)
3✔
1340
    }
1341
}
1342

1343
impl RemAssign<u8> for U8Vec2 {
1344
    #[inline]
1345
    fn rem_assign(&mut self, rhs: u8) {
3✔
1346
        self.x.rem_assign(rhs);
3✔
1347
        self.y.rem_assign(rhs);
4✔
1348
    }
1349
}
1350

1351
impl RemAssign<&u8> for U8Vec2 {
1352
    #[inline]
1353
    fn rem_assign(&mut self, rhs: &u8) {
3✔
1354
        self.rem_assign(*rhs);
3✔
1355
    }
1356
}
1357

1358
impl Rem<U8Vec2> for u8 {
1359
    type Output = U8Vec2;
1360
    #[inline]
1361
    fn rem(self, rhs: U8Vec2) -> U8Vec2 {
3✔
1362
        U8Vec2 {
1363
            x: self.rem(rhs.x),
3✔
1364
            y: self.rem(rhs.y),
3✔
1365
        }
1366
    }
1367
}
1368

1369
impl Rem<&U8Vec2> for u8 {
1370
    type Output = U8Vec2;
1371
    #[inline]
1372
    fn rem(self, rhs: &U8Vec2) -> U8Vec2 {
3✔
1373
        self.rem(*rhs)
3✔
1374
    }
1375
}
1376

1377
impl Rem<&U8Vec2> for &u8 {
1378
    type Output = U8Vec2;
1379
    #[inline]
1380
    fn rem(self, rhs: &U8Vec2) -> U8Vec2 {
3✔
1381
        (*self).rem(*rhs)
3✔
1382
    }
1383
}
1384

1385
impl Rem<U8Vec2> for &u8 {
1386
    type Output = U8Vec2;
1387
    #[inline]
1388
    fn rem(self, rhs: U8Vec2) -> U8Vec2 {
3✔
1389
        (*self).rem(rhs)
3✔
1390
    }
1391
}
1392

1393
impl AsRef<[u8; 2]> for U8Vec2 {
1394
    #[inline]
1395
    fn as_ref(&self) -> &[u8; 2] {
3✔
1396
        unsafe { &*(self as *const Self as *const [u8; 2]) }
3✔
1397
    }
1398
}
1399

1400
impl AsMut<[u8; 2]> for U8Vec2 {
1401
    #[inline]
1402
    fn as_mut(&mut self) -> &mut [u8; 2] {
3✔
1403
        unsafe { &mut *(self as *mut Self as *mut [u8; 2]) }
3✔
1404
    }
1405
}
1406

1407
impl Sum for U8Vec2 {
1408
    #[inline]
1409
    fn sum<I>(iter: I) -> Self
3✔
1410
    where
1411
        I: Iterator<Item = Self>,
1412
    {
1413
        iter.fold(Self::ZERO, Self::add)
3✔
1414
    }
1415
}
1416

1417
impl<'a> Sum<&'a Self> for U8Vec2 {
1418
    #[inline]
1419
    fn sum<I>(iter: I) -> Self
3✔
1420
    where
1421
        I: Iterator<Item = &'a Self>,
1422
    {
1423
        iter.fold(Self::ZERO, |a, &b| Self::add(a, b))
9✔
1424
    }
1425
}
1426

1427
impl Product for U8Vec2 {
1428
    #[inline]
1429
    fn product<I>(iter: I) -> Self
3✔
1430
    where
1431
        I: Iterator<Item = Self>,
1432
    {
1433
        iter.fold(Self::ONE, Self::mul)
3✔
1434
    }
1435
}
1436

1437
impl<'a> Product<&'a Self> for U8Vec2 {
1438
    #[inline]
1439
    fn product<I>(iter: I) -> Self
3✔
1440
    where
1441
        I: Iterator<Item = &'a Self>,
1442
    {
1443
        iter.fold(Self::ONE, |a, &b| Self::mul(a, b))
9✔
1444
    }
1445
}
1446

1447
impl Not for U8Vec2 {
1448
    type Output = Self;
1449
    #[inline]
1450
    fn not(self) -> Self {
3✔
1451
        Self {
1452
            x: self.x.not(),
3✔
1453
            y: self.y.not(),
3✔
1454
        }
1455
    }
1456
}
1457

1458
impl Not for &U8Vec2 {
1459
    type Output = U8Vec2;
1460
    #[inline]
1461
    fn not(self) -> U8Vec2 {
3✔
1462
        (*self).not()
3✔
1463
    }
1464
}
1465

1466
impl BitAnd for U8Vec2 {
1467
    type Output = Self;
1468
    #[inline]
1469
    fn bitand(self, rhs: Self) -> Self::Output {
3✔
1470
        Self {
1471
            x: self.x.bitand(rhs.x),
3✔
1472
            y: self.y.bitand(rhs.y),
3✔
1473
        }
1474
    }
1475
}
1476

1477
impl BitAnd<&Self> for U8Vec2 {
1478
    type Output = Self;
1479
    #[inline]
1480
    fn bitand(self, rhs: &Self) -> Self {
3✔
1481
        self.bitand(*rhs)
3✔
1482
    }
1483
}
1484

1485
impl BitAnd<&U8Vec2> for &U8Vec2 {
1486
    type Output = U8Vec2;
1487
    #[inline]
1488
    fn bitand(self, rhs: &U8Vec2) -> U8Vec2 {
3✔
1489
        (*self).bitand(*rhs)
3✔
1490
    }
1491
}
1492

1493
impl BitAnd<U8Vec2> for &U8Vec2 {
1494
    type Output = U8Vec2;
1495
    #[inline]
1496
    fn bitand(self, rhs: U8Vec2) -> U8Vec2 {
3✔
1497
        (*self).bitand(rhs)
3✔
1498
    }
1499
}
1500

1501
impl BitAndAssign for U8Vec2 {
1502
    #[inline]
1503
    fn bitand_assign(&mut self, rhs: Self) {
3✔
1504
        *self = self.bitand(rhs);
3✔
1505
    }
1506
}
1507

1508
impl BitAndAssign<&Self> for U8Vec2 {
1509
    #[inline]
1510
    fn bitand_assign(&mut self, rhs: &Self) {
3✔
1511
        self.bitand_assign(*rhs);
3✔
1512
    }
1513
}
1514

1515
impl BitOr for U8Vec2 {
1516
    type Output = Self;
1517
    #[inline]
1518
    fn bitor(self, rhs: Self) -> Self::Output {
3✔
1519
        Self {
1520
            x: self.x.bitor(rhs.x),
3✔
1521
            y: self.y.bitor(rhs.y),
3✔
1522
        }
1523
    }
1524
}
1525

1526
impl BitOr<&Self> for U8Vec2 {
1527
    type Output = Self;
1528
    #[inline]
1529
    fn bitor(self, rhs: &Self) -> Self {
3✔
1530
        self.bitor(*rhs)
3✔
1531
    }
1532
}
1533

1534
impl BitOr<&U8Vec2> for &U8Vec2 {
1535
    type Output = U8Vec2;
1536
    #[inline]
1537
    fn bitor(self, rhs: &U8Vec2) -> U8Vec2 {
3✔
1538
        (*self).bitor(*rhs)
3✔
1539
    }
1540
}
1541

1542
impl BitOr<U8Vec2> for &U8Vec2 {
1543
    type Output = U8Vec2;
1544
    #[inline]
1545
    fn bitor(self, rhs: U8Vec2) -> U8Vec2 {
3✔
1546
        (*self).bitor(rhs)
3✔
1547
    }
1548
}
1549

1550
impl BitOrAssign for U8Vec2 {
1551
    #[inline]
1552
    fn bitor_assign(&mut self, rhs: Self) {
3✔
1553
        *self = self.bitor(rhs);
3✔
1554
    }
1555
}
1556

1557
impl BitOrAssign<&Self> for U8Vec2 {
1558
    #[inline]
1559
    fn bitor_assign(&mut self, rhs: &Self) {
3✔
1560
        self.bitor_assign(*rhs);
3✔
1561
    }
1562
}
1563

1564
impl BitXor for U8Vec2 {
1565
    type Output = Self;
1566
    #[inline]
1567
    fn bitxor(self, rhs: Self) -> Self::Output {
3✔
1568
        Self {
1569
            x: self.x.bitxor(rhs.x),
3✔
1570
            y: self.y.bitxor(rhs.y),
3✔
1571
        }
1572
    }
1573
}
1574

1575
impl BitXor<&Self> for U8Vec2 {
1576
    type Output = Self;
1577
    #[inline]
1578
    fn bitxor(self, rhs: &Self) -> Self {
3✔
1579
        self.bitxor(*rhs)
3✔
1580
    }
1581
}
1582

1583
impl BitXor<&U8Vec2> for &U8Vec2 {
1584
    type Output = U8Vec2;
1585
    #[inline]
1586
    fn bitxor(self, rhs: &U8Vec2) -> U8Vec2 {
3✔
1587
        (*self).bitxor(*rhs)
3✔
1588
    }
1589
}
1590

1591
impl BitXor<U8Vec2> for &U8Vec2 {
1592
    type Output = U8Vec2;
1593
    #[inline]
1594
    fn bitxor(self, rhs: U8Vec2) -> U8Vec2 {
3✔
1595
        (*self).bitxor(rhs)
3✔
1596
    }
1597
}
1598

1599
impl BitXorAssign for U8Vec2 {
1600
    #[inline]
1601
    fn bitxor_assign(&mut self, rhs: Self) {
3✔
1602
        *self = self.bitxor(rhs);
3✔
1603
    }
1604
}
1605

1606
impl BitXorAssign<&Self> for U8Vec2 {
1607
    #[inline]
1608
    fn bitxor_assign(&mut self, rhs: &Self) {
3✔
1609
        self.bitxor_assign(*rhs);
3✔
1610
    }
1611
}
1612

1613
impl BitAnd<u8> for U8Vec2 {
1614
    type Output = Self;
1615
    #[inline]
1616
    fn bitand(self, rhs: u8) -> Self::Output {
3✔
1617
        Self {
1618
            x: self.x.bitand(rhs),
3✔
1619
            y: self.y.bitand(rhs),
3✔
1620
        }
1621
    }
1622
}
1623

1624
impl BitAnd<&u8> for U8Vec2 {
1625
    type Output = Self;
1626
    #[inline]
1627
    fn bitand(self, rhs: &u8) -> Self {
3✔
1628
        self.bitand(*rhs)
3✔
1629
    }
1630
}
1631

1632
impl BitAnd<&u8> for &U8Vec2 {
1633
    type Output = U8Vec2;
1634
    #[inline]
1635
    fn bitand(self, rhs: &u8) -> U8Vec2 {
3✔
1636
        (*self).bitand(*rhs)
3✔
1637
    }
1638
}
1639

1640
impl BitAnd<u8> for &U8Vec2 {
1641
    type Output = U8Vec2;
1642
    #[inline]
1643
    fn bitand(self, rhs: u8) -> U8Vec2 {
3✔
1644
        (*self).bitand(rhs)
3✔
1645
    }
1646
}
1647

1648
impl BitAndAssign<u8> for U8Vec2 {
1649
    #[inline]
1650
    fn bitand_assign(&mut self, rhs: u8) {
3✔
1651
        *self = self.bitand(rhs);
3✔
1652
    }
1653
}
1654

1655
impl BitAndAssign<&u8> for U8Vec2 {
1656
    #[inline]
1657
    fn bitand_assign(&mut self, rhs: &u8) {
3✔
1658
        self.bitand_assign(*rhs);
3✔
1659
    }
1660
}
1661

1662
impl BitOr<u8> for U8Vec2 {
1663
    type Output = Self;
1664
    #[inline]
1665
    fn bitor(self, rhs: u8) -> Self::Output {
3✔
1666
        Self {
1667
            x: self.x.bitor(rhs),
3✔
1668
            y: self.y.bitor(rhs),
3✔
1669
        }
1670
    }
1671
}
1672

1673
impl BitOr<&u8> for U8Vec2 {
1674
    type Output = Self;
1675
    #[inline]
1676
    fn bitor(self, rhs: &u8) -> Self {
3✔
1677
        self.bitor(*rhs)
3✔
1678
    }
1679
}
1680

1681
impl BitOr<&u8> for &U8Vec2 {
1682
    type Output = U8Vec2;
1683
    #[inline]
1684
    fn bitor(self, rhs: &u8) -> U8Vec2 {
3✔
1685
        (*self).bitor(*rhs)
3✔
1686
    }
1687
}
1688

1689
impl BitOr<u8> for &U8Vec2 {
1690
    type Output = U8Vec2;
1691
    #[inline]
1692
    fn bitor(self, rhs: u8) -> U8Vec2 {
3✔
1693
        (*self).bitor(rhs)
3✔
1694
    }
1695
}
1696

1697
impl BitOrAssign<u8> for U8Vec2 {
1698
    #[inline]
1699
    fn bitor_assign(&mut self, rhs: u8) {
3✔
1700
        *self = self.bitor(rhs);
3✔
1701
    }
1702
}
1703

1704
impl BitOrAssign<&u8> for U8Vec2 {
1705
    #[inline]
1706
    fn bitor_assign(&mut self, rhs: &u8) {
3✔
1707
        self.bitor_assign(*rhs);
3✔
1708
    }
1709
}
1710

1711
impl BitXor<u8> for U8Vec2 {
1712
    type Output = Self;
1713
    #[inline]
1714
    fn bitxor(self, rhs: u8) -> Self::Output {
3✔
1715
        Self {
1716
            x: self.x.bitxor(rhs),
3✔
1717
            y: self.y.bitxor(rhs),
3✔
1718
        }
1719
    }
1720
}
1721

1722
impl BitXor<&u8> for U8Vec2 {
1723
    type Output = Self;
1724
    #[inline]
1725
    fn bitxor(self, rhs: &u8) -> Self {
3✔
1726
        self.bitxor(*rhs)
3✔
1727
    }
1728
}
1729

1730
impl BitXor<&u8> for &U8Vec2 {
1731
    type Output = U8Vec2;
1732
    #[inline]
1733
    fn bitxor(self, rhs: &u8) -> U8Vec2 {
3✔
1734
        (*self).bitxor(*rhs)
3✔
1735
    }
1736
}
1737

1738
impl BitXor<u8> for &U8Vec2 {
1739
    type Output = U8Vec2;
1740
    #[inline]
1741
    fn bitxor(self, rhs: u8) -> U8Vec2 {
3✔
1742
        (*self).bitxor(rhs)
3✔
1743
    }
1744
}
1745

1746
impl BitXorAssign<u8> for U8Vec2 {
1747
    #[inline]
1748
    fn bitxor_assign(&mut self, rhs: u8) {
3✔
1749
        *self = self.bitxor(rhs);
3✔
1750
    }
1751
}
1752

1753
impl BitXorAssign<&u8> for U8Vec2 {
1754
    #[inline]
1755
    fn bitxor_assign(&mut self, rhs: &u8) {
3✔
1756
        self.bitxor_assign(*rhs);
3✔
1757
    }
1758
}
1759

1760
impl Shl<i8> for U8Vec2 {
1761
    type Output = Self;
1762
    #[inline]
1763
    fn shl(self, rhs: i8) -> Self::Output {
3✔
1764
        Self {
1765
            x: self.x.shl(rhs),
3✔
1766
            y: self.y.shl(rhs),
3✔
1767
        }
1768
    }
1769
}
1770

1771
impl Shl<&i8> for U8Vec2 {
1772
    type Output = Self;
1773
    #[inline]
1774
    fn shl(self, rhs: &i8) -> Self {
3✔
1775
        self.shl(*rhs)
3✔
1776
    }
1777
}
1778

1779
impl Shl<&i8> for &U8Vec2 {
1780
    type Output = U8Vec2;
1781
    #[inline]
1782
    fn shl(self, rhs: &i8) -> U8Vec2 {
3✔
1783
        (*self).shl(*rhs)
3✔
1784
    }
1785
}
1786

1787
impl Shl<i8> for &U8Vec2 {
1788
    type Output = U8Vec2;
1789
    #[inline]
1790
    fn shl(self, rhs: i8) -> U8Vec2 {
3✔
1791
        (*self).shl(rhs)
3✔
1792
    }
1793
}
1794

1795
impl ShlAssign<i8> for U8Vec2 {
1796
    #[inline]
1797
    fn shl_assign(&mut self, rhs: i8) {
3✔
1798
        *self = self.shl(rhs);
3✔
1799
    }
1800
}
1801

1802
impl ShlAssign<&i8> for U8Vec2 {
1803
    #[inline]
1804
    fn shl_assign(&mut self, rhs: &i8) {
3✔
1805
        self.shl_assign(*rhs);
3✔
1806
    }
1807
}
1808

1809
impl Shr<i8> for U8Vec2 {
1810
    type Output = Self;
1811
    #[inline]
1812
    fn shr(self, rhs: i8) -> Self::Output {
3✔
1813
        Self {
1814
            x: self.x.shr(rhs),
3✔
1815
            y: self.y.shr(rhs),
3✔
1816
        }
1817
    }
1818
}
1819

1820
impl Shr<&i8> for U8Vec2 {
1821
    type Output = Self;
1822
    #[inline]
1823
    fn shr(self, rhs: &i8) -> Self {
3✔
1824
        self.shr(*rhs)
3✔
1825
    }
1826
}
1827

1828
impl Shr<&i8> for &U8Vec2 {
1829
    type Output = U8Vec2;
1830
    #[inline]
1831
    fn shr(self, rhs: &i8) -> U8Vec2 {
3✔
1832
        (*self).shr(*rhs)
3✔
1833
    }
1834
}
1835

1836
impl Shr<i8> for &U8Vec2 {
1837
    type Output = U8Vec2;
1838
    #[inline]
1839
    fn shr(self, rhs: i8) -> U8Vec2 {
3✔
1840
        (*self).shr(rhs)
3✔
1841
    }
1842
}
1843

1844
impl ShrAssign<i8> for U8Vec2 {
1845
    #[inline]
1846
    fn shr_assign(&mut self, rhs: i8) {
3✔
1847
        *self = self.shr(rhs);
3✔
1848
    }
1849
}
1850

1851
impl ShrAssign<&i8> for U8Vec2 {
1852
    #[inline]
1853
    fn shr_assign(&mut self, rhs: &i8) {
3✔
1854
        self.shr_assign(*rhs);
3✔
1855
    }
1856
}
1857

1858
impl Shl<i16> for U8Vec2 {
1859
    type Output = Self;
1860
    #[inline]
1861
    fn shl(self, rhs: i16) -> Self::Output {
3✔
1862
        Self {
1863
            x: self.x.shl(rhs),
3✔
1864
            y: self.y.shl(rhs),
3✔
1865
        }
1866
    }
1867
}
1868

1869
impl Shl<&i16> for U8Vec2 {
1870
    type Output = Self;
1871
    #[inline]
1872
    fn shl(self, rhs: &i16) -> Self {
3✔
1873
        self.shl(*rhs)
3✔
1874
    }
1875
}
1876

1877
impl Shl<&i16> for &U8Vec2 {
1878
    type Output = U8Vec2;
1879
    #[inline]
1880
    fn shl(self, rhs: &i16) -> U8Vec2 {
3✔
1881
        (*self).shl(*rhs)
3✔
1882
    }
1883
}
1884

1885
impl Shl<i16> for &U8Vec2 {
1886
    type Output = U8Vec2;
1887
    #[inline]
1888
    fn shl(self, rhs: i16) -> U8Vec2 {
3✔
1889
        (*self).shl(rhs)
3✔
1890
    }
1891
}
1892

1893
impl ShlAssign<i16> for U8Vec2 {
1894
    #[inline]
1895
    fn shl_assign(&mut self, rhs: i16) {
3✔
1896
        *self = self.shl(rhs);
3✔
1897
    }
1898
}
1899

1900
impl ShlAssign<&i16> for U8Vec2 {
1901
    #[inline]
1902
    fn shl_assign(&mut self, rhs: &i16) {
3✔
1903
        self.shl_assign(*rhs);
3✔
1904
    }
1905
}
1906

1907
impl Shr<i16> for U8Vec2 {
1908
    type Output = Self;
1909
    #[inline]
1910
    fn shr(self, rhs: i16) -> Self::Output {
3✔
1911
        Self {
1912
            x: self.x.shr(rhs),
3✔
1913
            y: self.y.shr(rhs),
3✔
1914
        }
1915
    }
1916
}
1917

1918
impl Shr<&i16> for U8Vec2 {
1919
    type Output = Self;
1920
    #[inline]
1921
    fn shr(self, rhs: &i16) -> Self {
3✔
1922
        self.shr(*rhs)
3✔
1923
    }
1924
}
1925

1926
impl Shr<&i16> for &U8Vec2 {
1927
    type Output = U8Vec2;
1928
    #[inline]
1929
    fn shr(self, rhs: &i16) -> U8Vec2 {
3✔
1930
        (*self).shr(*rhs)
3✔
1931
    }
1932
}
1933

1934
impl Shr<i16> for &U8Vec2 {
1935
    type Output = U8Vec2;
1936
    #[inline]
1937
    fn shr(self, rhs: i16) -> U8Vec2 {
3✔
1938
        (*self).shr(rhs)
3✔
1939
    }
1940
}
1941

1942
impl ShrAssign<i16> for U8Vec2 {
1943
    #[inline]
1944
    fn shr_assign(&mut self, rhs: i16) {
3✔
1945
        *self = self.shr(rhs);
3✔
1946
    }
1947
}
1948

1949
impl ShrAssign<&i16> for U8Vec2 {
1950
    #[inline]
1951
    fn shr_assign(&mut self, rhs: &i16) {
3✔
1952
        self.shr_assign(*rhs);
3✔
1953
    }
1954
}
1955

1956
impl Shl<i32> for U8Vec2 {
1957
    type Output = Self;
1958
    #[inline]
1959
    fn shl(self, rhs: i32) -> Self::Output {
3✔
1960
        Self {
1961
            x: self.x.shl(rhs),
3✔
1962
            y: self.y.shl(rhs),
3✔
1963
        }
1964
    }
1965
}
1966

1967
impl Shl<&i32> for U8Vec2 {
1968
    type Output = Self;
1969
    #[inline]
1970
    fn shl(self, rhs: &i32) -> Self {
3✔
1971
        self.shl(*rhs)
3✔
1972
    }
1973
}
1974

1975
impl Shl<&i32> for &U8Vec2 {
1976
    type Output = U8Vec2;
1977
    #[inline]
1978
    fn shl(self, rhs: &i32) -> U8Vec2 {
3✔
1979
        (*self).shl(*rhs)
3✔
1980
    }
1981
}
1982

1983
impl Shl<i32> for &U8Vec2 {
1984
    type Output = U8Vec2;
1985
    #[inline]
1986
    fn shl(self, rhs: i32) -> U8Vec2 {
3✔
1987
        (*self).shl(rhs)
3✔
1988
    }
1989
}
1990

1991
impl ShlAssign<i32> for U8Vec2 {
1992
    #[inline]
1993
    fn shl_assign(&mut self, rhs: i32) {
3✔
1994
        *self = self.shl(rhs);
3✔
1995
    }
1996
}
1997

1998
impl ShlAssign<&i32> for U8Vec2 {
1999
    #[inline]
2000
    fn shl_assign(&mut self, rhs: &i32) {
3✔
2001
        self.shl_assign(*rhs);
3✔
2002
    }
2003
}
2004

2005
impl Shr<i32> for U8Vec2 {
2006
    type Output = Self;
2007
    #[inline]
2008
    fn shr(self, rhs: i32) -> Self::Output {
3✔
2009
        Self {
2010
            x: self.x.shr(rhs),
3✔
2011
            y: self.y.shr(rhs),
3✔
2012
        }
2013
    }
2014
}
2015

2016
impl Shr<&i32> for U8Vec2 {
2017
    type Output = Self;
2018
    #[inline]
2019
    fn shr(self, rhs: &i32) -> Self {
3✔
2020
        self.shr(*rhs)
3✔
2021
    }
2022
}
2023

2024
impl Shr<&i32> for &U8Vec2 {
2025
    type Output = U8Vec2;
2026
    #[inline]
2027
    fn shr(self, rhs: &i32) -> U8Vec2 {
3✔
2028
        (*self).shr(*rhs)
3✔
2029
    }
2030
}
2031

2032
impl Shr<i32> for &U8Vec2 {
2033
    type Output = U8Vec2;
2034
    #[inline]
2035
    fn shr(self, rhs: i32) -> U8Vec2 {
3✔
2036
        (*self).shr(rhs)
3✔
2037
    }
2038
}
2039

2040
impl ShrAssign<i32> for U8Vec2 {
2041
    #[inline]
2042
    fn shr_assign(&mut self, rhs: i32) {
3✔
2043
        *self = self.shr(rhs);
3✔
2044
    }
2045
}
2046

2047
impl ShrAssign<&i32> for U8Vec2 {
2048
    #[inline]
2049
    fn shr_assign(&mut self, rhs: &i32) {
3✔
2050
        self.shr_assign(*rhs);
3✔
2051
    }
2052
}
2053

2054
impl Shl<i64> for U8Vec2 {
2055
    type Output = Self;
2056
    #[inline]
2057
    fn shl(self, rhs: i64) -> Self::Output {
3✔
2058
        Self {
2059
            x: self.x.shl(rhs),
3✔
2060
            y: self.y.shl(rhs),
3✔
2061
        }
2062
    }
2063
}
2064

2065
impl Shl<&i64> for U8Vec2 {
2066
    type Output = Self;
2067
    #[inline]
2068
    fn shl(self, rhs: &i64) -> Self {
3✔
2069
        self.shl(*rhs)
3✔
2070
    }
2071
}
2072

2073
impl Shl<&i64> for &U8Vec2 {
2074
    type Output = U8Vec2;
2075
    #[inline]
2076
    fn shl(self, rhs: &i64) -> U8Vec2 {
3✔
2077
        (*self).shl(*rhs)
3✔
2078
    }
2079
}
2080

2081
impl Shl<i64> for &U8Vec2 {
2082
    type Output = U8Vec2;
2083
    #[inline]
2084
    fn shl(self, rhs: i64) -> U8Vec2 {
3✔
2085
        (*self).shl(rhs)
3✔
2086
    }
2087
}
2088

2089
impl ShlAssign<i64> for U8Vec2 {
2090
    #[inline]
2091
    fn shl_assign(&mut self, rhs: i64) {
3✔
2092
        *self = self.shl(rhs);
3✔
2093
    }
2094
}
2095

2096
impl ShlAssign<&i64> for U8Vec2 {
2097
    #[inline]
2098
    fn shl_assign(&mut self, rhs: &i64) {
3✔
2099
        self.shl_assign(*rhs);
3✔
2100
    }
2101
}
2102

2103
impl Shr<i64> for U8Vec2 {
2104
    type Output = Self;
2105
    #[inline]
2106
    fn shr(self, rhs: i64) -> Self::Output {
3✔
2107
        Self {
2108
            x: self.x.shr(rhs),
3✔
2109
            y: self.y.shr(rhs),
3✔
2110
        }
2111
    }
2112
}
2113

2114
impl Shr<&i64> for U8Vec2 {
2115
    type Output = Self;
2116
    #[inline]
2117
    fn shr(self, rhs: &i64) -> Self {
3✔
2118
        self.shr(*rhs)
3✔
2119
    }
2120
}
2121

2122
impl Shr<&i64> for &U8Vec2 {
2123
    type Output = U8Vec2;
2124
    #[inline]
2125
    fn shr(self, rhs: &i64) -> U8Vec2 {
3✔
2126
        (*self).shr(*rhs)
3✔
2127
    }
2128
}
2129

2130
impl Shr<i64> for &U8Vec2 {
2131
    type Output = U8Vec2;
2132
    #[inline]
2133
    fn shr(self, rhs: i64) -> U8Vec2 {
3✔
2134
        (*self).shr(rhs)
3✔
2135
    }
2136
}
2137

2138
impl ShrAssign<i64> for U8Vec2 {
2139
    #[inline]
2140
    fn shr_assign(&mut self, rhs: i64) {
3✔
2141
        *self = self.shr(rhs);
3✔
2142
    }
2143
}
2144

2145
impl ShrAssign<&i64> for U8Vec2 {
2146
    #[inline]
2147
    fn shr_assign(&mut self, rhs: &i64) {
3✔
2148
        self.shr_assign(*rhs);
3✔
2149
    }
2150
}
2151

2152
impl Shl<u8> for U8Vec2 {
2153
    type Output = Self;
2154
    #[inline]
2155
    fn shl(self, rhs: u8) -> Self::Output {
3✔
2156
        Self {
2157
            x: self.x.shl(rhs),
3✔
2158
            y: self.y.shl(rhs),
3✔
2159
        }
2160
    }
2161
}
2162

2163
impl Shl<&u8> for U8Vec2 {
2164
    type Output = Self;
2165
    #[inline]
2166
    fn shl(self, rhs: &u8) -> Self {
3✔
2167
        self.shl(*rhs)
3✔
2168
    }
2169
}
2170

2171
impl Shl<&u8> for &U8Vec2 {
2172
    type Output = U8Vec2;
2173
    #[inline]
2174
    fn shl(self, rhs: &u8) -> U8Vec2 {
3✔
2175
        (*self).shl(*rhs)
3✔
2176
    }
2177
}
2178

2179
impl Shl<u8> for &U8Vec2 {
2180
    type Output = U8Vec2;
2181
    #[inline]
2182
    fn shl(self, rhs: u8) -> U8Vec2 {
3✔
2183
        (*self).shl(rhs)
3✔
2184
    }
2185
}
2186

2187
impl ShlAssign<u8> for U8Vec2 {
2188
    #[inline]
2189
    fn shl_assign(&mut self, rhs: u8) {
3✔
2190
        *self = self.shl(rhs);
3✔
2191
    }
2192
}
2193

2194
impl ShlAssign<&u8> for U8Vec2 {
2195
    #[inline]
2196
    fn shl_assign(&mut self, rhs: &u8) {
3✔
2197
        self.shl_assign(*rhs);
3✔
2198
    }
2199
}
2200

2201
impl Shr<u8> for U8Vec2 {
2202
    type Output = Self;
2203
    #[inline]
2204
    fn shr(self, rhs: u8) -> Self::Output {
3✔
2205
        Self {
2206
            x: self.x.shr(rhs),
3✔
2207
            y: self.y.shr(rhs),
3✔
2208
        }
2209
    }
2210
}
2211

2212
impl Shr<&u8> for U8Vec2 {
2213
    type Output = Self;
2214
    #[inline]
2215
    fn shr(self, rhs: &u8) -> Self {
3✔
2216
        self.shr(*rhs)
3✔
2217
    }
2218
}
2219

2220
impl Shr<&u8> for &U8Vec2 {
2221
    type Output = U8Vec2;
2222
    #[inline]
2223
    fn shr(self, rhs: &u8) -> U8Vec2 {
3✔
2224
        (*self).shr(*rhs)
3✔
2225
    }
2226
}
2227

2228
impl Shr<u8> for &U8Vec2 {
2229
    type Output = U8Vec2;
2230
    #[inline]
2231
    fn shr(self, rhs: u8) -> U8Vec2 {
3✔
2232
        (*self).shr(rhs)
3✔
2233
    }
2234
}
2235

2236
impl ShrAssign<u8> for U8Vec2 {
2237
    #[inline]
2238
    fn shr_assign(&mut self, rhs: u8) {
3✔
2239
        *self = self.shr(rhs);
3✔
2240
    }
2241
}
2242

2243
impl ShrAssign<&u8> for U8Vec2 {
2244
    #[inline]
2245
    fn shr_assign(&mut self, rhs: &u8) {
3✔
2246
        self.shr_assign(*rhs);
3✔
2247
    }
2248
}
2249

2250
impl Shl<u16> for U8Vec2 {
2251
    type Output = Self;
2252
    #[inline]
2253
    fn shl(self, rhs: u16) -> Self::Output {
3✔
2254
        Self {
2255
            x: self.x.shl(rhs),
3✔
2256
            y: self.y.shl(rhs),
3✔
2257
        }
2258
    }
2259
}
2260

2261
impl Shl<&u16> for U8Vec2 {
2262
    type Output = Self;
2263
    #[inline]
2264
    fn shl(self, rhs: &u16) -> Self {
3✔
2265
        self.shl(*rhs)
3✔
2266
    }
2267
}
2268

2269
impl Shl<&u16> for &U8Vec2 {
2270
    type Output = U8Vec2;
2271
    #[inline]
2272
    fn shl(self, rhs: &u16) -> U8Vec2 {
3✔
2273
        (*self).shl(*rhs)
3✔
2274
    }
2275
}
2276

2277
impl Shl<u16> for &U8Vec2 {
2278
    type Output = U8Vec2;
2279
    #[inline]
2280
    fn shl(self, rhs: u16) -> U8Vec2 {
3✔
2281
        (*self).shl(rhs)
3✔
2282
    }
2283
}
2284

2285
impl ShlAssign<u16> for U8Vec2 {
2286
    #[inline]
2287
    fn shl_assign(&mut self, rhs: u16) {
3✔
2288
        *self = self.shl(rhs);
3✔
2289
    }
2290
}
2291

2292
impl ShlAssign<&u16> for U8Vec2 {
2293
    #[inline]
2294
    fn shl_assign(&mut self, rhs: &u16) {
3✔
2295
        self.shl_assign(*rhs);
3✔
2296
    }
2297
}
2298

2299
impl Shr<u16> for U8Vec2 {
2300
    type Output = Self;
2301
    #[inline]
2302
    fn shr(self, rhs: u16) -> Self::Output {
3✔
2303
        Self {
2304
            x: self.x.shr(rhs),
3✔
2305
            y: self.y.shr(rhs),
3✔
2306
        }
2307
    }
2308
}
2309

2310
impl Shr<&u16> for U8Vec2 {
2311
    type Output = Self;
2312
    #[inline]
2313
    fn shr(self, rhs: &u16) -> Self {
3✔
2314
        self.shr(*rhs)
3✔
2315
    }
2316
}
2317

2318
impl Shr<&u16> for &U8Vec2 {
2319
    type Output = U8Vec2;
2320
    #[inline]
2321
    fn shr(self, rhs: &u16) -> U8Vec2 {
3✔
2322
        (*self).shr(*rhs)
3✔
2323
    }
2324
}
2325

2326
impl Shr<u16> for &U8Vec2 {
2327
    type Output = U8Vec2;
2328
    #[inline]
2329
    fn shr(self, rhs: u16) -> U8Vec2 {
3✔
2330
        (*self).shr(rhs)
3✔
2331
    }
2332
}
2333

2334
impl ShrAssign<u16> for U8Vec2 {
2335
    #[inline]
2336
    fn shr_assign(&mut self, rhs: u16) {
3✔
2337
        *self = self.shr(rhs);
3✔
2338
    }
2339
}
2340

2341
impl ShrAssign<&u16> for U8Vec2 {
2342
    #[inline]
2343
    fn shr_assign(&mut self, rhs: &u16) {
3✔
2344
        self.shr_assign(*rhs);
3✔
2345
    }
2346
}
2347

2348
impl Shl<u32> for U8Vec2 {
2349
    type Output = Self;
2350
    #[inline]
2351
    fn shl(self, rhs: u32) -> Self::Output {
3✔
2352
        Self {
2353
            x: self.x.shl(rhs),
3✔
2354
            y: self.y.shl(rhs),
3✔
2355
        }
2356
    }
2357
}
2358

2359
impl Shl<&u32> for U8Vec2 {
2360
    type Output = Self;
2361
    #[inline]
2362
    fn shl(self, rhs: &u32) -> Self {
3✔
2363
        self.shl(*rhs)
3✔
2364
    }
2365
}
2366

2367
impl Shl<&u32> for &U8Vec2 {
2368
    type Output = U8Vec2;
2369
    #[inline]
2370
    fn shl(self, rhs: &u32) -> U8Vec2 {
3✔
2371
        (*self).shl(*rhs)
3✔
2372
    }
2373
}
2374

2375
impl Shl<u32> for &U8Vec2 {
2376
    type Output = U8Vec2;
2377
    #[inline]
2378
    fn shl(self, rhs: u32) -> U8Vec2 {
3✔
2379
        (*self).shl(rhs)
3✔
2380
    }
2381
}
2382

2383
impl ShlAssign<u32> for U8Vec2 {
2384
    #[inline]
2385
    fn shl_assign(&mut self, rhs: u32) {
3✔
2386
        *self = self.shl(rhs);
3✔
2387
    }
2388
}
2389

2390
impl ShlAssign<&u32> for U8Vec2 {
2391
    #[inline]
2392
    fn shl_assign(&mut self, rhs: &u32) {
3✔
2393
        self.shl_assign(*rhs);
3✔
2394
    }
2395
}
2396

2397
impl Shr<u32> for U8Vec2 {
2398
    type Output = Self;
2399
    #[inline]
2400
    fn shr(self, rhs: u32) -> Self::Output {
3✔
2401
        Self {
2402
            x: self.x.shr(rhs),
3✔
2403
            y: self.y.shr(rhs),
3✔
2404
        }
2405
    }
2406
}
2407

2408
impl Shr<&u32> for U8Vec2 {
2409
    type Output = Self;
2410
    #[inline]
2411
    fn shr(self, rhs: &u32) -> Self {
3✔
2412
        self.shr(*rhs)
3✔
2413
    }
2414
}
2415

2416
impl Shr<&u32> for &U8Vec2 {
2417
    type Output = U8Vec2;
2418
    #[inline]
2419
    fn shr(self, rhs: &u32) -> U8Vec2 {
3✔
2420
        (*self).shr(*rhs)
3✔
2421
    }
2422
}
2423

2424
impl Shr<u32> for &U8Vec2 {
2425
    type Output = U8Vec2;
2426
    #[inline]
2427
    fn shr(self, rhs: u32) -> U8Vec2 {
3✔
2428
        (*self).shr(rhs)
3✔
2429
    }
2430
}
2431

2432
impl ShrAssign<u32> for U8Vec2 {
2433
    #[inline]
2434
    fn shr_assign(&mut self, rhs: u32) {
3✔
2435
        *self = self.shr(rhs);
3✔
2436
    }
2437
}
2438

2439
impl ShrAssign<&u32> for U8Vec2 {
2440
    #[inline]
2441
    fn shr_assign(&mut self, rhs: &u32) {
3✔
2442
        self.shr_assign(*rhs);
3✔
2443
    }
2444
}
2445

2446
impl Shl<u64> for U8Vec2 {
2447
    type Output = Self;
2448
    #[inline]
2449
    fn shl(self, rhs: u64) -> Self::Output {
3✔
2450
        Self {
2451
            x: self.x.shl(rhs),
3✔
2452
            y: self.y.shl(rhs),
3✔
2453
        }
2454
    }
2455
}
2456

2457
impl Shl<&u64> for U8Vec2 {
2458
    type Output = Self;
2459
    #[inline]
2460
    fn shl(self, rhs: &u64) -> Self {
3✔
2461
        self.shl(*rhs)
3✔
2462
    }
2463
}
2464

2465
impl Shl<&u64> for &U8Vec2 {
2466
    type Output = U8Vec2;
2467
    #[inline]
2468
    fn shl(self, rhs: &u64) -> U8Vec2 {
3✔
2469
        (*self).shl(*rhs)
3✔
2470
    }
2471
}
2472

2473
impl Shl<u64> for &U8Vec2 {
2474
    type Output = U8Vec2;
2475
    #[inline]
2476
    fn shl(self, rhs: u64) -> U8Vec2 {
3✔
2477
        (*self).shl(rhs)
3✔
2478
    }
2479
}
2480

2481
impl ShlAssign<u64> for U8Vec2 {
2482
    #[inline]
2483
    fn shl_assign(&mut self, rhs: u64) {
3✔
2484
        *self = self.shl(rhs);
3✔
2485
    }
2486
}
2487

2488
impl ShlAssign<&u64> for U8Vec2 {
2489
    #[inline]
2490
    fn shl_assign(&mut self, rhs: &u64) {
3✔
2491
        self.shl_assign(*rhs);
3✔
2492
    }
2493
}
2494

2495
impl Shr<u64> for U8Vec2 {
2496
    type Output = Self;
2497
    #[inline]
2498
    fn shr(self, rhs: u64) -> Self::Output {
3✔
2499
        Self {
2500
            x: self.x.shr(rhs),
3✔
2501
            y: self.y.shr(rhs),
3✔
2502
        }
2503
    }
2504
}
2505

2506
impl Shr<&u64> for U8Vec2 {
2507
    type Output = Self;
2508
    #[inline]
2509
    fn shr(self, rhs: &u64) -> Self {
3✔
2510
        self.shr(*rhs)
3✔
2511
    }
2512
}
2513

2514
impl Shr<&u64> for &U8Vec2 {
2515
    type Output = U8Vec2;
2516
    #[inline]
2517
    fn shr(self, rhs: &u64) -> U8Vec2 {
3✔
2518
        (*self).shr(*rhs)
3✔
2519
    }
2520
}
2521

2522
impl Shr<u64> for &U8Vec2 {
2523
    type Output = U8Vec2;
2524
    #[inline]
2525
    fn shr(self, rhs: u64) -> U8Vec2 {
3✔
2526
        (*self).shr(rhs)
3✔
2527
    }
2528
}
2529

2530
impl ShrAssign<u64> for U8Vec2 {
2531
    #[inline]
2532
    fn shr_assign(&mut self, rhs: u64) {
3✔
2533
        *self = self.shr(rhs);
3✔
2534
    }
2535
}
2536

2537
impl ShrAssign<&u64> for U8Vec2 {
2538
    #[inline]
2539
    fn shr_assign(&mut self, rhs: &u64) {
3✔
2540
        self.shr_assign(*rhs);
3✔
2541
    }
2542
}
2543

2544
#[cfg(feature = "i32")]
2545

2546
impl Shl<IVec2> for U8Vec2 {
2547
    type Output = Self;
2548
    #[inline]
2549
    fn shl(self, rhs: IVec2) -> Self {
3✔
2550
        Self {
2551
            x: self.x.shl(rhs.x),
3✔
2552
            y: self.y.shl(rhs.y),
3✔
2553
        }
2554
    }
2555
}
2556

2557
#[cfg(feature = "i32")]
2558

2559
impl Shl<&IVec2> for U8Vec2 {
2560
    type Output = Self;
2561
    #[inline]
2562
    fn shl(self, rhs: &IVec2) -> Self {
3✔
2563
        self.shl(*rhs)
3✔
2564
    }
2565
}
2566

2567
#[cfg(feature = "i32")]
2568

2569
impl Shl<&IVec2> for &U8Vec2 {
2570
    type Output = U8Vec2;
2571
    #[inline]
2572
    fn shl(self, rhs: &IVec2) -> U8Vec2 {
3✔
2573
        (*self).shl(*rhs)
3✔
2574
    }
2575
}
2576

2577
#[cfg(feature = "i32")]
2578

2579
impl Shl<IVec2> for &U8Vec2 {
2580
    type Output = U8Vec2;
2581
    #[inline]
2582
    fn shl(self, rhs: IVec2) -> U8Vec2 {
3✔
2583
        (*self).shl(rhs)
3✔
2584
    }
2585
}
2586

2587
#[cfg(feature = "i32")]
2588

2589
impl Shr<IVec2> for U8Vec2 {
2590
    type Output = Self;
2591
    #[inline]
2592
    fn shr(self, rhs: IVec2) -> Self {
3✔
2593
        Self {
2594
            x: self.x.shr(rhs.x),
3✔
2595
            y: self.y.shr(rhs.y),
3✔
2596
        }
2597
    }
2598
}
2599

2600
#[cfg(feature = "i32")]
2601

2602
impl Shr<&IVec2> for U8Vec2 {
2603
    type Output = Self;
2604
    #[inline]
2605
    fn shr(self, rhs: &IVec2) -> Self {
3✔
2606
        self.shr(*rhs)
3✔
2607
    }
2608
}
2609

2610
#[cfg(feature = "i32")]
2611

2612
impl Shr<&IVec2> for &U8Vec2 {
2613
    type Output = U8Vec2;
2614
    #[inline]
2615
    fn shr(self, rhs: &IVec2) -> U8Vec2 {
3✔
2616
        (*self).shr(*rhs)
3✔
2617
    }
2618
}
2619

2620
#[cfg(feature = "i32")]
2621

2622
impl Shr<IVec2> for &U8Vec2 {
2623
    type Output = U8Vec2;
2624
    #[inline]
2625
    fn shr(self, rhs: IVec2) -> U8Vec2 {
3✔
2626
        (*self).shr(rhs)
3✔
2627
    }
2628
}
2629

2630
#[cfg(feature = "u32")]
2631

2632
impl Shl<UVec2> for U8Vec2 {
2633
    type Output = Self;
2634
    #[inline]
2635
    fn shl(self, rhs: UVec2) -> Self {
3✔
2636
        Self {
2637
            x: self.x.shl(rhs.x),
3✔
2638
            y: self.y.shl(rhs.y),
3✔
2639
        }
2640
    }
2641
}
2642

2643
#[cfg(feature = "u32")]
2644

2645
impl Shl<&UVec2> for U8Vec2 {
2646
    type Output = Self;
2647
    #[inline]
2648
    fn shl(self, rhs: &UVec2) -> Self {
3✔
2649
        self.shl(*rhs)
3✔
2650
    }
2651
}
2652

2653
#[cfg(feature = "u32")]
2654

2655
impl Shl<&UVec2> for &U8Vec2 {
2656
    type Output = U8Vec2;
2657
    #[inline]
2658
    fn shl(self, rhs: &UVec2) -> U8Vec2 {
3✔
2659
        (*self).shl(*rhs)
3✔
2660
    }
2661
}
2662

2663
#[cfg(feature = "u32")]
2664

2665
impl Shl<UVec2> for &U8Vec2 {
2666
    type Output = U8Vec2;
2667
    #[inline]
2668
    fn shl(self, rhs: UVec2) -> U8Vec2 {
3✔
2669
        (*self).shl(rhs)
3✔
2670
    }
2671
}
2672

2673
#[cfg(feature = "u32")]
2674

2675
impl Shr<UVec2> for U8Vec2 {
2676
    type Output = Self;
2677
    #[inline]
2678
    fn shr(self, rhs: UVec2) -> Self {
3✔
2679
        Self {
2680
            x: self.x.shr(rhs.x),
3✔
2681
            y: self.y.shr(rhs.y),
3✔
2682
        }
2683
    }
2684
}
2685

2686
#[cfg(feature = "u32")]
2687

2688
impl Shr<&UVec2> for U8Vec2 {
2689
    type Output = Self;
2690
    #[inline]
2691
    fn shr(self, rhs: &UVec2) -> Self {
3✔
2692
        self.shr(*rhs)
3✔
2693
    }
2694
}
2695

2696
#[cfg(feature = "u32")]
2697

2698
impl Shr<&UVec2> for &U8Vec2 {
2699
    type Output = U8Vec2;
2700
    #[inline]
2701
    fn shr(self, rhs: &UVec2) -> U8Vec2 {
3✔
2702
        (*self).shr(*rhs)
3✔
2703
    }
2704
}
2705

2706
#[cfg(feature = "u32")]
2707

2708
impl Shr<UVec2> for &U8Vec2 {
2709
    type Output = U8Vec2;
2710
    #[inline]
2711
    fn shr(self, rhs: UVec2) -> U8Vec2 {
3✔
2712
        (*self).shr(rhs)
3✔
2713
    }
2714
}
2715

2716
impl Index<usize> for U8Vec2 {
2717
    type Output = u8;
2718
    #[inline]
2719
    fn index(&self, index: usize) -> &Self::Output {
3✔
2720
        match index {
6✔
2721
            0 => &self.x,
3✔
2722
            1 => &self.y,
3✔
2723
            _ => panic!("index out of bounds"),
×
2724
        }
2725
    }
2726
}
2727

2728
impl IndexMut<usize> for U8Vec2 {
2729
    #[inline]
2730
    fn index_mut(&mut self, index: usize) -> &mut Self::Output {
3✔
2731
        match index {
6✔
2732
            0 => &mut self.x,
3✔
2733
            1 => &mut self.y,
3✔
2734
            _ => panic!("index out of bounds"),
×
2735
        }
2736
    }
2737
}
2738

2739
impl fmt::Display for U8Vec2 {
2740
    fn fmt(&self, f: &mut fmt::Formatter<'_>) -> fmt::Result {
3✔
2741
        write!(f, "[{}, {}]", self.x, self.y)
3✔
2742
    }
2743
}
2744

2745
impl fmt::Debug for U8Vec2 {
2746
    fn fmt(&self, fmt: &mut fmt::Formatter<'_>) -> fmt::Result {
3✔
2747
        fmt.debug_tuple(stringify!(U8Vec2))
3✔
2748
            .field(&self.x)
3✔
2749
            .field(&self.y)
3✔
2750
            .finish()
2751
    }
2752
}
2753

2754
impl From<[u8; 2]> for U8Vec2 {
2755
    #[inline]
2756
    fn from(a: [u8; 2]) -> Self {
6✔
2757
        Self::new(a[0], a[1])
6✔
2758
    }
2759
}
2760

2761
impl From<U8Vec2> for [u8; 2] {
2762
    #[inline]
2763
    fn from(v: U8Vec2) -> Self {
3✔
2764
        [v.x, v.y]
3✔
2765
    }
2766
}
2767

2768
impl From<(u8, u8)> for U8Vec2 {
2769
    #[inline]
2770
    fn from(t: (u8, u8)) -> Self {
3✔
2771
        Self::new(t.0, t.1)
×
2772
    }
2773
}
2774

2775
impl From<U8Vec2> for (u8, u8) {
2776
    #[inline]
2777
    fn from(v: U8Vec2) -> Self {
6✔
2778
        (v.x, v.y)
×
2779
    }
2780
}
2781

2782
#[cfg(feature = "i8")]
2783

2784
impl TryFrom<I8Vec2> for U8Vec2 {
2785
    type Error = core::num::TryFromIntError;
2786

2787
    #[inline]
2788
    fn try_from(v: I8Vec2) -> Result<Self, Self::Error> {
3✔
2789
        Ok(Self::new(u8::try_from(v.x)?, u8::try_from(v.y)?))
3✔
2790
    }
2791
}
2792

2793
#[cfg(feature = "i16")]
2794

2795
impl TryFrom<I16Vec2> for U8Vec2 {
2796
    type Error = core::num::TryFromIntError;
2797

2798
    #[inline]
2799
    fn try_from(v: I16Vec2) -> Result<Self, Self::Error> {
3✔
2800
        Ok(Self::new(u8::try_from(v.x)?, u8::try_from(v.y)?))
3✔
2801
    }
2802
}
2803

2804
#[cfg(feature = "u16")]
2805

2806
impl TryFrom<U16Vec2> for U8Vec2 {
2807
    type Error = core::num::TryFromIntError;
2808

2809
    #[inline]
2810
    fn try_from(v: U16Vec2) -> Result<Self, Self::Error> {
3✔
2811
        Ok(Self::new(u8::try_from(v.x)?, u8::try_from(v.y)?))
3✔
2812
    }
2813
}
2814

2815
#[cfg(feature = "i32")]
2816

2817
impl TryFrom<IVec2> for U8Vec2 {
2818
    type Error = core::num::TryFromIntError;
2819

2820
    #[inline]
2821
    fn try_from(v: IVec2) -> Result<Self, Self::Error> {
3✔
2822
        Ok(Self::new(u8::try_from(v.x)?, u8::try_from(v.y)?))
3✔
2823
    }
2824
}
2825

2826
#[cfg(feature = "u32")]
2827

2828
impl TryFrom<UVec2> for U8Vec2 {
2829
    type Error = core::num::TryFromIntError;
2830

2831
    #[inline]
2832
    fn try_from(v: UVec2) -> Result<Self, Self::Error> {
3✔
2833
        Ok(Self::new(u8::try_from(v.x)?, u8::try_from(v.y)?))
3✔
2834
    }
2835
}
2836

2837
#[cfg(feature = "i64")]
2838

2839
impl TryFrom<I64Vec2> for U8Vec2 {
2840
    type Error = core::num::TryFromIntError;
2841

2842
    #[inline]
2843
    fn try_from(v: I64Vec2) -> Result<Self, Self::Error> {
3✔
2844
        Ok(Self::new(u8::try_from(v.x)?, u8::try_from(v.y)?))
3✔
2845
    }
2846
}
2847

2848
#[cfg(feature = "u64")]
2849

2850
impl TryFrom<U64Vec2> for U8Vec2 {
2851
    type Error = core::num::TryFromIntError;
2852

2853
    #[inline]
2854
    fn try_from(v: U64Vec2) -> Result<Self, Self::Error> {
3✔
2855
        Ok(Self::new(u8::try_from(v.x)?, u8::try_from(v.y)?))
3✔
2856
    }
2857
}
2858

2859
#[cfg(feature = "isize")]
2860

2861
impl TryFrom<ISizeVec2> for U8Vec2 {
2862
    type Error = core::num::TryFromIntError;
2863

2864
    #[inline]
2865
    fn try_from(v: ISizeVec2) -> Result<Self, Self::Error> {
3✔
2866
        Ok(Self::new(u8::try_from(v.x)?, u8::try_from(v.y)?))
3✔
2867
    }
2868
}
2869

2870
#[cfg(feature = "usize")]
2871

2872
impl TryFrom<USizeVec2> for U8Vec2 {
2873
    type Error = core::num::TryFromIntError;
2874

2875
    #[inline]
2876
    fn try_from(v: USizeVec2) -> Result<Self, Self::Error> {
3✔
2877
        Ok(Self::new(u8::try_from(v.x)?, u8::try_from(v.y)?))
3✔
2878
    }
2879
}
2880

2881
impl From<BVec2> for U8Vec2 {
2882
    #[inline]
2883
    fn from(v: BVec2) -> Self {
3✔
2884
        Self::new(u8::from(v.x), u8::from(v.y))
3✔
2885
    }
2886
}
STATUS · Troubleshooting · Open an Issue · Sales · Support · CAREERS · ENTERPRISE · START FREE · SCHEDULE DEMO
ANNOUNCEMENTS · TWITTER · TOS & SLA · Supported CI Services · What's a CI service? · Automated Testing

© 2026 Coveralls, Inc