1#![allow(clippy::partialeq_ne_impl)]
2
3use core::fmt;
4
5#[repr(transparent)]
7#[derive(Copy, Clone)]
8pub struct Dev32(u32);
9
10impl Dev32 {
11 #[inline]
13 pub const fn new(value: u32) -> Self {
14 Self(value)
15 }
16
17 #[inline]
19 pub const fn major(&self) -> u32 {
20 (self.0 >> 8) & 0xff
21 }
22
23 #[inline]
25 pub const fn minor(&self) -> u32 {
26 (self.0 >> 19) | (self.0 & 0xff)
27 }
28
29 #[inline]
31 pub const fn as_u32(&self) -> u32 {
32 self.0
33 }
34
35 #[inline]
37 pub const fn as_u64(&self) -> u64 {
38 DevSplit::new(self.major(), self.minor()).as_u64()
39 }
40}
41
42impl core::hash::Hash for Dev32 {
43 #[inline]
44 fn hash<H: core::hash::Hasher>(&self, state: &mut H) {
45 self.as_u64().hash(state);
46 }
47}
48
49impl fmt::Debug for Dev32 {
50 #[inline]
51 fn fmt(&self, f: &mut fmt::Formatter<'_>) -> fmt::Result {
52 write!(f, "Dev32({}:{})", self.major(), self.minor())
53 }
54}
55
56impl PartialEq for Dev32 {
57 #[inline]
58 fn eq(&self, other: &Self) -> bool {
59 self.0 == other.0
60 }
61
62 #[inline]
63 fn ne(&self, other: &Self) -> bool {
64 self.0 != other.0
65 }
66}
67
68impl PartialEq<DevSplit> for Dev32 {
69 #[inline]
70 fn eq(&self, other: &DevSplit) -> bool {
71 self.major() == other.major() && self.minor() == other.minor()
72 }
73
74 #[inline]
75 fn ne(&self, other: &DevSplit) -> bool {
76 self.major() != other.major() || self.minor() != other.minor()
77 }
78}
79
80impl PartialEq<Dev64> for Dev32 {
81 #[inline]
82 fn eq(&self, other: &Dev64) -> bool {
83 self.major() == other.major() && self.minor() == other.minor()
84 }
85
86 #[inline]
87 fn ne(&self, other: &Dev64) -> bool {
88 self.major() != other.major() || self.minor() != other.minor()
89 }
90}
91
92impl PartialEq<Dev> for Dev32 {
93 fn eq(&self, other: &Dev) -> bool {
94 match other {
95 Dev::B32(d) => self.eq(d),
96 Dev::Split(d) => self.eq(d),
97 Dev::B64(d) => self.eq(d),
98 }
99 }
100
101 fn ne(&self, other: &Dev) -> bool {
102 match other {
103 Dev::B32(d) => self.ne(d),
104 Dev::Split(d) => self.ne(d),
105 Dev::B64(d) => self.ne(d),
106 }
107 }
108}
109
110impl PartialEq<u32> for Dev32 {
111 #[inline]
112 fn eq(&self, other: &u32) -> bool {
113 self.0 == *other
114 }
115
116 #[inline]
117 fn ne(&self, other: &u32) -> bool {
118 self.0 != *other
119 }
120}
121
122impl PartialEq<(u32, u32)> for Dev32 {
123 #[inline]
124 fn eq(&self, other: &(u32, u32)) -> bool {
125 self.eq(&DevSplit::new(other.0, other.1))
126 }
127
128 #[inline]
129 fn ne(&self, other: &(u32, u32)) -> bool {
130 self.ne(&DevSplit::new(other.0, other.1))
131 }
132}
133
134impl PartialEq<u64> for Dev32 {
135 #[inline]
136 fn eq(&self, other: &u64) -> bool {
137 self.eq(&Dev64::new(*other))
138 }
139
140 #[inline]
141 fn ne(&self, other: &u64) -> bool {
142 self.ne(&Dev64::new(*other))
143 }
144}
145
146impl Eq for Dev32 {}
147
148impl PartialOrd for Dev32 {
149 #[inline]
150 fn partial_cmp(&self, other: &Self) -> Option<core::cmp::Ordering> {
151 Some(self.cmp(other))
152 }
153
154 #[inline]
155 fn lt(&self, other: &Self) -> bool {
156 self.0.lt(&other.0)
157 }
158
159 #[inline]
160 fn le(&self, other: &Self) -> bool {
161 self.0.le(&other.0)
162 }
163
164 #[inline]
165 fn gt(&self, other: &Self) -> bool {
166 self.0.gt(&other.0)
167 }
168
169 #[inline]
170 fn ge(&self, other: &Self) -> bool {
171 self.0.ge(&other.0)
172 }
173}
174
175impl PartialOrd<u32> for Dev32 {
176 #[inline]
177 fn partial_cmp(&self, other: &u32) -> Option<core::cmp::Ordering> {
178 self.0.partial_cmp(other)
179 }
180
181 #[inline]
182 fn lt(&self, other: &u32) -> bool {
183 self.0.lt(other)
184 }
185
186 #[inline]
187 fn le(&self, other: &u32) -> bool {
188 self.0.le(other)
189 }
190
191 #[inline]
192 fn gt(&self, other: &u32) -> bool {
193 self.0.gt(other)
194 }
195
196 #[inline]
197 fn ge(&self, other: &u32) -> bool {
198 self.0.ge(other)
199 }
200}
201
202impl PartialOrd<DevSplit> for Dev32 {
203 fn partial_cmp(&self, other: &DevSplit) -> Option<core::cmp::Ordering> {
204 match self.major().partial_cmp(&other.major()) {
205 Some(core::cmp::Ordering::Equal) => {}
206 ord => return ord,
207 }
208 self.minor().partial_cmp(&other.minor())
209 }
210
211 fn lt(&self, other: &DevSplit) -> bool {
212 match self.major().cmp(&other.major()) {
213 core::cmp::Ordering::Equal => (),
214 core::cmp::Ordering::Less => return true,
215 _ => return false,
216 }
217 self.minor().lt(&other.minor())
218 }
219
220 fn le(&self, other: &DevSplit) -> bool {
221 match self.major().cmp(&other.major()) {
222 core::cmp::Ordering::Equal => (),
223 core::cmp::Ordering::Less => return true,
224 _ => return false,
225 }
226 self.minor().le(&other.minor())
227 }
228
229 fn gt(&self, other: &DevSplit) -> bool {
230 match self.major().cmp(&other.major()) {
231 core::cmp::Ordering::Equal => (),
232 core::cmp::Ordering::Greater => return true,
233 _ => return false,
234 }
235 self.minor().gt(&other.minor())
236 }
237
238 fn ge(&self, other: &DevSplit) -> bool {
239 match self.major().cmp(&other.major()) {
240 core::cmp::Ordering::Equal => (),
241 core::cmp::Ordering::Greater => return true,
242 _ => return false,
243 }
244 self.minor().ge(&other.minor())
245 }
246}
247
248impl PartialOrd<(u32, u32)> for Dev32 {
249 fn partial_cmp(&self, other: &(u32, u32)) -> Option<core::cmp::Ordering> {
250 match self.major().partial_cmp(&other.0) {
251 Some(core::cmp::Ordering::Equal) => {}
252 ord => return ord,
253 }
254 self.minor().partial_cmp(&other.1)
255 }
256
257 fn lt(&self, other: &(u32, u32)) -> bool {
258 match self.major().cmp(&other.0) {
259 core::cmp::Ordering::Equal => (),
260 core::cmp::Ordering::Less => return true,
261 _ => return false,
262 }
263 self.minor().lt(&other.1)
264 }
265
266 fn le(&self, other: &(u32, u32)) -> bool {
267 match self.major().cmp(&other.0) {
268 core::cmp::Ordering::Equal => (),
269 core::cmp::Ordering::Less => return true,
270 _ => return false,
271 }
272 self.minor().le(&other.1)
273 }
274
275 fn gt(&self, other: &(u32, u32)) -> bool {
276 match self.major().cmp(&other.0) {
277 core::cmp::Ordering::Equal => (),
278 core::cmp::Ordering::Greater => return true,
279 _ => return false,
280 }
281 self.minor().gt(&other.1)
282 }
283
284 fn ge(&self, other: &(u32, u32)) -> bool {
285 match self.major().cmp(&other.0) {
286 core::cmp::Ordering::Equal => (),
287 core::cmp::Ordering::Greater => return true,
288 _ => return false,
289 }
290 self.minor().ge(&other.1)
291 }
292}
293
294impl PartialOrd<Dev64> for Dev32 {
295 fn partial_cmp(&self, other: &Dev64) -> Option<core::cmp::Ordering> {
296 match self.major().partial_cmp(&other.major()) {
297 Some(core::cmp::Ordering::Equal) => {}
298 ord => return ord,
299 }
300 self.minor().partial_cmp(&other.minor())
301 }
302
303 fn lt(&self, other: &Dev64) -> bool {
304 match self.major().cmp(&other.major()) {
305 core::cmp::Ordering::Equal => (),
306 core::cmp::Ordering::Less => return true,
307 _ => return false,
308 }
309 self.minor().lt(&other.minor())
310 }
311
312 fn le(&self, other: &Dev64) -> bool {
313 match self.major().cmp(&other.major()) {
314 core::cmp::Ordering::Equal => (),
315 core::cmp::Ordering::Less => return true,
316 _ => return false,
317 }
318 self.minor().le(&other.minor())
319 }
320
321 fn gt(&self, other: &Dev64) -> bool {
322 match self.major().cmp(&other.major()) {
323 core::cmp::Ordering::Equal => (),
324 core::cmp::Ordering::Greater => return true,
325 _ => return false,
326 }
327 self.minor().gt(&other.minor())
328 }
329
330 fn ge(&self, other: &Dev64) -> bool {
331 match self.major().cmp(&other.major()) {
332 core::cmp::Ordering::Equal => (),
333 core::cmp::Ordering::Greater => return true,
334 _ => return false,
335 }
336 self.minor().ge(&other.minor())
337 }
338}
339
340impl PartialOrd<u64> for Dev32 {
341 #[inline]
342 fn partial_cmp(&self, other: &u64) -> Option<core::cmp::Ordering> {
343 self.partial_cmp(&Dev64::new(*other))
344 }
345
346 #[inline]
347 fn lt(&self, other: &u64) -> bool {
348 self.lt(&Dev64::new(*other))
349 }
350
351 #[inline]
352 fn le(&self, other: &u64) -> bool {
353 self.le(&Dev64::new(*other))
354 }
355
356 #[inline]
357 fn gt(&self, other: &u64) -> bool {
358 self.gt(&Dev64::new(*other))
359 }
360
361 #[inline]
362 fn ge(&self, other: &u64) -> bool {
363 self.ge(&Dev64::new(*other))
364 }
365}
366
367impl PartialOrd<Dev> for Dev32 {
368 fn partial_cmp(&self, other: &Dev) -> Option<core::cmp::Ordering> {
369 match other {
370 Dev::B32(d) => self.partial_cmp(d),
371 Dev::Split(d) => self.partial_cmp(d),
372 Dev::B64(d) => self.partial_cmp(d),
373 }
374 }
375
376 fn lt(&self, other: &Dev) -> bool {
377 match other {
378 Dev::B32(d) => self.lt(d),
379 Dev::Split(d) => self.lt(d),
380 Dev::B64(d) => self.lt(d),
381 }
382 }
383
384 fn le(&self, other: &Dev) -> bool {
385 match other {
386 Dev::B32(d) => self.le(d),
387 Dev::Split(d) => self.le(d),
388 Dev::B64(d) => self.le(d),
389 }
390 }
391
392 fn gt(&self, other: &Dev) -> bool {
393 match other {
394 Dev::B32(d) => self.gt(d),
395 Dev::Split(d) => self.gt(d),
396 Dev::B64(d) => self.gt(d),
397 }
398 }
399
400 fn ge(&self, other: &Dev) -> bool {
401 match other {
402 Dev::B32(d) => self.ge(d),
403 Dev::Split(d) => self.ge(d),
404 Dev::B64(d) => self.ge(d),
405 }
406 }
407}
408
409impl Ord for Dev32 {
410 #[inline]
411 fn cmp(&self, other: &Self) -> core::cmp::Ordering {
412 self.0.cmp(&other.0)
413 }
414}
415
416impl From<Dev32> for u32 {
417 #[inline]
418 fn from(value: Dev32) -> Self {
419 value.as_u32()
420 }
421}
422
423impl From<Dev32> for u64 {
424 #[inline]
425 fn from(value: Dev32) -> Self {
426 value.as_u64()
427 }
428}
429
430#[derive(Copy, Clone)]
432pub struct DevSplit(u32, u32);
433
434impl DevSplit {
435 #[inline]
437 pub const fn new(major: u32, minor: u32) -> Self {
438 Self(major, minor)
439 }
440
441 #[inline]
443 pub const fn major(&self) -> u32 {
444 self.0
445 }
446
447 #[inline]
449 pub const fn minor(&self) -> u32 {
450 self.1
451 }
452
453 #[inline]
455 pub const fn as_u64(&self) -> u64 {
456 (((self.0 as u64) & 0xfffff000) << 32)
457 | ((self.0 as u64) & 0x00000fff) << 8
458 | (((self.1 as u64) & 0xffffff00) << 12)
459 | (self.1 as u64) & 0xff
460 }
461}
462
463impl fmt::Debug for DevSplit {
464 #[inline]
465 fn fmt(&self, f: &mut fmt::Formatter<'_>) -> fmt::Result {
466 write!(f, "DevSplit({}:{})", self.major(), self.minor())
467 }
468}
469
470impl core::hash::Hash for DevSplit {
471 #[inline]
472 fn hash<H: core::hash::Hasher>(&self, state: &mut H) {
473 self.as_u64().hash(state);
474 }
475}
476
477impl PartialEq for DevSplit {
478 #[inline]
479 fn eq(&self, other: &Self) -> bool {
480 self.major() == other.major() && self.minor() == other.minor()
481 }
482
483 #[inline]
484 fn ne(&self, other: &Self) -> bool {
485 self.major() != other.major() || self.minor() != other.minor()
486 }
487}
488
489impl PartialEq<Dev32> for DevSplit {
490 #[inline]
491 fn eq(&self, other: &Dev32) -> bool {
492 self.major() == other.major() && self.minor() == other.minor()
493 }
494
495 #[inline]
496 fn ne(&self, other: &Dev32) -> bool {
497 self.major() != other.major() || self.minor() != other.minor()
498 }
499}
500
501impl PartialEq<Dev64> for DevSplit {
502 #[inline]
503 fn eq(&self, other: &Dev64) -> bool {
504 self.major() == other.major() && self.minor() == other.minor()
505 }
506
507 #[inline]
508 fn ne(&self, other: &Dev64) -> bool {
509 self.major() != other.major() || self.minor() != other.minor()
510 }
511}
512
513impl PartialEq<Dev> for DevSplit {
514 fn eq(&self, other: &Dev) -> bool {
515 match other {
516 Dev::B32(d) => self.eq(d),
517 Dev::Split(d) => self.eq(d),
518 Dev::B64(d) => self.eq(d),
519 }
520 }
521
522 fn ne(&self, other: &Dev) -> bool {
523 match other {
524 Dev::B32(d) => self.ne(d),
525 Dev::Split(d) => self.ne(d),
526 Dev::B64(d) => self.ne(d),
527 }
528 }
529}
530
531impl PartialEq<u32> for DevSplit {
532 #[inline]
533 fn eq(&self, other: &u32) -> bool {
534 self.eq(&Dev32::new(*other))
535 }
536
537 #[inline]
538 fn ne(&self, other: &u32) -> bool {
539 self.ne(&Dev32::new(*other))
540 }
541}
542
543impl PartialEq<(u32, u32)> for DevSplit {
544 #[inline]
545 fn eq(&self, other: &(u32, u32)) -> bool {
546 self.0 == other.0 && self.1 == other.1
547 }
548
549 #[inline]
550 fn ne(&self, other: &(u32, u32)) -> bool {
551 self.0 != other.0 || self.1 != other.1
552 }
553}
554
555impl PartialEq<u64> for DevSplit {
556 #[inline]
557 fn eq(&self, other: &u64) -> bool {
558 self.eq(&Dev64::new(*other))
559 }
560
561 #[inline]
562 fn ne(&self, other: &u64) -> bool {
563 self.ne(&Dev64::new(*other))
564 }
565}
566
567impl Eq for DevSplit {}
568
569impl PartialOrd for DevSplit {
570 #[inline]
571 fn partial_cmp(&self, other: &Self) -> Option<core::cmp::Ordering> {
572 Some(self.cmp(other))
573 }
574
575 fn lt(&self, other: &Self) -> bool {
576 match self.major().cmp(&other.major()) {
577 core::cmp::Ordering::Equal => (),
578 core::cmp::Ordering::Less => return true,
579 _ => return false,
580 }
581 self.minor().lt(&other.minor())
582 }
583
584 fn le(&self, other: &Self) -> bool {
585 match self.major().cmp(&other.major()) {
586 core::cmp::Ordering::Equal => (),
587 core::cmp::Ordering::Less => return true,
588 _ => return false,
589 }
590 self.minor().le(&other.minor())
591 }
592
593 fn gt(&self, other: &Self) -> bool {
594 match self.major().cmp(&other.major()) {
595 core::cmp::Ordering::Equal => (),
596 core::cmp::Ordering::Greater => return true,
597 _ => return false,
598 }
599 self.minor().gt(&other.minor())
600 }
601
602 fn ge(&self, other: &Self) -> bool {
603 match self.major().cmp(&other.major()) {
604 core::cmp::Ordering::Equal => (),
605 core::cmp::Ordering::Greater => return true,
606 _ => return false,
607 }
608 self.minor().ge(&other.minor())
609 }
610}
611
612impl PartialOrd<(u32, u32)> for DevSplit {
613 fn partial_cmp(&self, other: &(u32, u32)) -> Option<core::cmp::Ordering> {
614 match self.major().partial_cmp(&other.0) {
615 Some(core::cmp::Ordering::Equal) => {}
616 ord => return ord,
617 }
618 self.minor().partial_cmp(&other.1)
619 }
620
621 fn lt(&self, other: &(u32, u32)) -> bool {
622 match self.major().cmp(&other.0) {
623 core::cmp::Ordering::Equal => (),
624 core::cmp::Ordering::Less => return true,
625 _ => return false,
626 }
627 self.minor().lt(&other.1)
628 }
629
630 fn le(&self, other: &(u32, u32)) -> bool {
631 match self.major().cmp(&other.0) {
632 core::cmp::Ordering::Equal => (),
633 core::cmp::Ordering::Less => return true,
634 _ => return false,
635 }
636 self.minor().le(&other.1)
637 }
638
639 fn gt(&self, other: &(u32, u32)) -> bool {
640 match self.major().cmp(&other.0) {
641 core::cmp::Ordering::Equal => (),
642 core::cmp::Ordering::Greater => return true,
643 _ => return false,
644 }
645 self.minor().gt(&other.1)
646 }
647
648 fn ge(&self, other: &(u32, u32)) -> bool {
649 match self.major().cmp(&other.0) {
650 core::cmp::Ordering::Equal => (),
651 core::cmp::Ordering::Greater => return true,
652 _ => return false,
653 }
654 self.minor().ge(&other.1)
655 }
656}
657
658impl PartialOrd<Dev32> for DevSplit {
659 fn partial_cmp(&self, other: &Dev32) -> Option<core::cmp::Ordering> {
660 match self.major().partial_cmp(&other.major()) {
661 Some(core::cmp::Ordering::Equal) => {}
662 ord => return ord,
663 }
664 self.minor().partial_cmp(&other.minor())
665 }
666
667 fn lt(&self, other: &Dev32) -> bool {
668 match self.major().cmp(&other.major()) {
669 core::cmp::Ordering::Equal => (),
670 core::cmp::Ordering::Less => return true,
671 _ => return false,
672 }
673 self.minor().lt(&other.minor())
674 }
675
676 fn le(&self, other: &Dev32) -> bool {
677 match self.major().cmp(&other.major()) {
678 core::cmp::Ordering::Equal => (),
679 core::cmp::Ordering::Less => return true,
680 _ => return false,
681 }
682 self.minor().le(&other.minor())
683 }
684
685 fn gt(&self, other: &Dev32) -> bool {
686 match self.major().cmp(&other.major()) {
687 core::cmp::Ordering::Equal => (),
688 core::cmp::Ordering::Greater => return true,
689 _ => return false,
690 }
691 self.minor().gt(&other.minor())
692 }
693
694 fn ge(&self, other: &Dev32) -> bool {
695 match self.major().cmp(&other.major()) {
696 core::cmp::Ordering::Equal => (),
697 core::cmp::Ordering::Greater => return true,
698 _ => return false,
699 }
700 self.minor().ge(&other.minor())
701 }
702}
703
704impl PartialOrd<u32> for DevSplit {
705 #[inline]
706 fn partial_cmp(&self, other: &u32) -> Option<core::cmp::Ordering> {
707 self.partial_cmp(&Dev32::new(*other))
708 }
709
710 #[inline]
711 fn lt(&self, other: &u32) -> bool {
712 self.lt(&Dev32::new(*other))
713 }
714
715 #[inline]
716 fn le(&self, other: &u32) -> bool {
717 self.le(&Dev32::new(*other))
718 }
719
720 #[inline]
721 fn gt(&self, other: &u32) -> bool {
722 self.gt(&Dev32::new(*other))
723 }
724
725 #[inline]
726 fn ge(&self, other: &u32) -> bool {
727 self.ge(&Dev32::new(*other))
728 }
729}
730
731impl PartialOrd<Dev64> for DevSplit {
732 fn partial_cmp(&self, other: &Dev64) -> Option<core::cmp::Ordering> {
733 match self.major().partial_cmp(&other.major()) {
734 Some(core::cmp::Ordering::Equal) => {}
735 ord => return ord,
736 }
737 self.minor().partial_cmp(&other.minor())
738 }
739
740 fn lt(&self, other: &Dev64) -> bool {
741 match self.major().cmp(&other.major()) {
742 core::cmp::Ordering::Equal => (),
743 core::cmp::Ordering::Less => return true,
744 _ => return false,
745 }
746 self.minor().lt(&other.minor())
747 }
748
749 fn le(&self, other: &Dev64) -> bool {
750 match self.major().cmp(&other.major()) {
751 core::cmp::Ordering::Equal => (),
752 core::cmp::Ordering::Less => return true,
753 _ => return false,
754 }
755 self.minor().le(&other.minor())
756 }
757
758 fn gt(&self, other: &Dev64) -> bool {
759 match self.major().cmp(&other.major()) {
760 core::cmp::Ordering::Equal => (),
761 core::cmp::Ordering::Greater => return true,
762 _ => return false,
763 }
764 self.minor().gt(&other.minor())
765 }
766
767 fn ge(&self, other: &Dev64) -> bool {
768 match self.major().cmp(&other.major()) {
769 core::cmp::Ordering::Equal => (),
770 core::cmp::Ordering::Greater => return true,
771 _ => return false,
772 }
773 self.minor().ge(&other.minor())
774 }
775}
776
777impl PartialOrd<u64> for DevSplit {
778 #[inline]
779 fn partial_cmp(&self, other: &u64) -> Option<core::cmp::Ordering> {
780 self.partial_cmp(&Dev64::new(*other))
781 }
782
783 #[inline]
784 fn lt(&self, other: &u64) -> bool {
785 self.lt(&Dev64::new(*other))
786 }
787
788 #[inline]
789 fn le(&self, other: &u64) -> bool {
790 self.le(&Dev64::new(*other))
791 }
792
793 #[inline]
794 fn gt(&self, other: &u64) -> bool {
795 self.gt(&Dev64::new(*other))
796 }
797
798 #[inline]
799 fn ge(&self, other: &u64) -> bool {
800 self.ge(&Dev64::new(*other))
801 }
802}
803
804impl PartialOrd<Dev> for DevSplit {
805 fn partial_cmp(&self, other: &Dev) -> Option<core::cmp::Ordering> {
806 match other {
807 Dev::B32(d) => self.partial_cmp(d),
808 Dev::Split(d) => self.partial_cmp(d),
809 Dev::B64(d) => self.partial_cmp(d),
810 }
811 }
812
813 fn lt(&self, other: &Dev) -> bool {
814 match other {
815 Dev::B32(d) => self.lt(d),
816 Dev::Split(d) => self.lt(d),
817 Dev::B64(d) => self.lt(d),
818 }
819 }
820
821 fn le(&self, other: &Dev) -> bool {
822 match other {
823 Dev::B32(d) => self.le(d),
824 Dev::Split(d) => self.le(d),
825 Dev::B64(d) => self.le(d),
826 }
827 }
828
829 fn gt(&self, other: &Dev) -> bool {
830 match other {
831 Dev::B32(d) => self.gt(d),
832 Dev::Split(d) => self.gt(d),
833 Dev::B64(d) => self.gt(d),
834 }
835 }
836
837 fn ge(&self, other: &Dev) -> bool {
838 match other {
839 Dev::B32(d) => self.ge(d),
840 Dev::Split(d) => self.ge(d),
841 Dev::B64(d) => self.ge(d),
842 }
843 }
844}
845
846impl Ord for DevSplit {
847 fn cmp(&self, other: &Self) -> core::cmp::Ordering {
848 match self.major().cmp(&other.major()) {
849 core::cmp::Ordering::Equal => {}
850 ord => return ord,
851 }
852 self.minor().cmp(&other.minor())
853 }
854}
855
856impl From<DevSplit> for u64 {
857 #[inline]
858 fn from(value: DevSplit) -> Self {
859 value.as_u64()
860 }
861}
862
863#[repr(transparent)]
865#[derive(Copy, Clone)]
866pub struct Dev64(u64);
867
868impl Dev64 {
869 #[inline]
871 pub const fn new(value: u64) -> Self {
872 Self(value)
873 }
874
875 #[inline]
877 pub const fn major(&self) -> u32 {
878 (((self.0 >> 32) & 0xfffff000) | ((self.0 >> 8) & 0xfff)) as u32
879 }
880
881 #[inline]
883 pub const fn minor(&self) -> u32 {
884 (((self.0 >> 12) & 0xffffff00) | (self.0 & 0xff)) as u32
885 }
886
887 #[inline]
889 pub const fn as_u64(&self) -> u64 {
890 self.0
891 }
892}
893
894impl fmt::Debug for Dev64 {
895 #[inline]
896 fn fmt(&self, f: &mut fmt::Formatter<'_>) -> fmt::Result {
897 write!(f, "Dev64({}:{})", self.major(), self.minor())
898 }
899}
900
901impl core::hash::Hash for Dev64 {
902 #[inline]
903 fn hash<H: core::hash::Hasher>(&self, state: &mut H) {
904 self.as_u64().hash(state);
905 }
906}
907
908impl PartialEq for Dev64 {
909 #[inline]
910 fn eq(&self, other: &Self) -> bool {
911 self.0 == other.0
912 }
913
914 #[inline]
915 fn ne(&self, other: &Dev64) -> bool {
916 self.0 != other.0
917 }
918}
919
920impl PartialEq<Dev32> for Dev64 {
921 #[inline]
922 fn eq(&self, other: &Dev32) -> bool {
923 self.major() == other.major() && self.minor() == other.minor()
924 }
925
926 #[inline]
927 fn ne(&self, other: &Dev32) -> bool {
928 self.major() != other.major() || self.minor() != other.minor()
929 }
930}
931
932impl PartialEq<DevSplit> for Dev64 {
933 #[inline]
934 fn eq(&self, other: &DevSplit) -> bool {
935 self.major() == other.major() && self.minor() == other.minor()
936 }
937
938 #[inline]
939 fn ne(&self, other: &DevSplit) -> bool {
940 self.major() != other.major() || self.minor() != other.minor()
941 }
942}
943
944impl PartialEq<Dev> for Dev64 {
945 fn eq(&self, other: &Dev) -> bool {
946 match other {
947 Dev::B32(d) => self.eq(d),
948 Dev::Split(d) => self.eq(d),
949 Dev::B64(d) => self.eq(d),
950 }
951 }
952
953 fn ne(&self, other: &Dev) -> bool {
954 match other {
955 Dev::B32(d) => self.ne(d),
956 Dev::Split(d) => self.ne(d),
957 Dev::B64(d) => self.ne(d),
958 }
959 }
960}
961
962impl PartialEq<u32> for Dev64 {
963 #[inline]
964 fn eq(&self, other: &u32) -> bool {
965 self.eq(&Dev32::new(*other))
966 }
967
968 #[inline]
969 fn ne(&self, other: &u32) -> bool {
970 self.ne(&Dev32::new(*other))
971 }
972}
973
974impl PartialEq<(u32, u32)> for Dev64 {
975 #[inline]
976 fn eq(&self, other: &(u32, u32)) -> bool {
977 self.eq(&DevSplit::new(other.0, other.1))
978 }
979
980 #[inline]
981 fn ne(&self, other: &(u32, u32)) -> bool {
982 self.ne(&DevSplit::new(other.0, other.1))
983 }
984}
985
986impl PartialEq<u64> for Dev64 {
987 #[inline]
988 fn eq(&self, other: &u64) -> bool {
989 self.0 == *other
990 }
991
992 #[inline]
993 fn ne(&self, other: &u64) -> bool {
994 self.0 != *other
995 }
996}
997
998impl Eq for Dev64 {}
999
1000impl PartialOrd for Dev64 {
1001 #[inline]
1002 fn partial_cmp(&self, other: &Self) -> Option<core::cmp::Ordering> {
1003 Some(self.cmp(other))
1004 }
1005
1006 #[inline]
1007 fn lt(&self, other: &Self) -> bool {
1008 self.0.lt(&other.0)
1009 }
1010
1011 #[inline]
1012 fn le(&self, other: &Self) -> bool {
1013 self.0.le(&other.0)
1014 }
1015
1016 #[inline]
1017 fn gt(&self, other: &Self) -> bool {
1018 self.0.gt(&other.0)
1019 }
1020
1021 #[inline]
1022 fn ge(&self, other: &Self) -> bool {
1023 self.0.ge(&other.0)
1024 }
1025}
1026
1027impl PartialOrd<u64> for Dev64 {
1028 #[inline]
1029 fn partial_cmp(&self, other: &u64) -> Option<core::cmp::Ordering> {
1030 self.0.partial_cmp(other)
1031 }
1032
1033 #[inline]
1034 fn lt(&self, other: &u64) -> bool {
1035 self.0.lt(other)
1036 }
1037
1038 #[inline]
1039 fn le(&self, other: &u64) -> bool {
1040 self.0.le(other)
1041 }
1042
1043 #[inline]
1044 fn gt(&self, other: &u64) -> bool {
1045 self.0.gt(other)
1046 }
1047
1048 #[inline]
1049 fn ge(&self, other: &u64) -> bool {
1050 self.0.ge(other)
1051 }
1052}
1053
1054impl PartialOrd<Dev32> for Dev64 {
1055 fn partial_cmp(&self, other: &Dev32) -> Option<core::cmp::Ordering> {
1056 match self.major().partial_cmp(&other.major()) {
1057 Some(core::cmp::Ordering::Equal) => {}
1058 ord => return ord,
1059 }
1060 self.minor().partial_cmp(&other.minor())
1061 }
1062
1063 fn lt(&self, other: &Dev32) -> bool {
1064 match self.major().cmp(&other.major()) {
1065 core::cmp::Ordering::Equal => (),
1066 core::cmp::Ordering::Less => return true,
1067 _ => return false,
1068 }
1069 self.minor().lt(&other.minor())
1070 }
1071
1072 fn le(&self, other: &Dev32) -> bool {
1073 match self.major().cmp(&other.major()) {
1074 core::cmp::Ordering::Equal => (),
1075 core::cmp::Ordering::Less => return true,
1076 _ => return false,
1077 }
1078 self.minor().le(&other.minor())
1079 }
1080
1081 fn gt(&self, other: &Dev32) -> bool {
1082 match self.major().cmp(&other.major()) {
1083 core::cmp::Ordering::Equal => (),
1084 core::cmp::Ordering::Greater => return true,
1085 _ => return false,
1086 }
1087 self.minor().gt(&other.minor())
1088 }
1089
1090 fn ge(&self, other: &Dev32) -> bool {
1091 match self.major().cmp(&other.major()) {
1092 core::cmp::Ordering::Equal => (),
1093 core::cmp::Ordering::Greater => return true,
1094 _ => return false,
1095 }
1096 self.minor().ge(&other.minor())
1097 }
1098}
1099
1100impl PartialOrd<u32> for Dev64 {
1101 #[inline]
1102 fn partial_cmp(&self, other: &u32) -> Option<core::cmp::Ordering> {
1103 self.partial_cmp(&Dev32::new(*other))
1104 }
1105
1106 #[inline]
1107 fn lt(&self, other: &u32) -> bool {
1108 self.lt(&Dev32::new(*other))
1109 }
1110
1111 #[inline]
1112 fn le(&self, other: &u32) -> bool {
1113 self.le(&Dev32::new(*other))
1114 }
1115
1116 #[inline]
1117 fn gt(&self, other: &u32) -> bool {
1118 self.gt(&Dev32::new(*other))
1119 }
1120
1121 #[inline]
1122 fn ge(&self, other: &u32) -> bool {
1123 self.ge(&Dev32::new(*other))
1124 }
1125}
1126
1127impl PartialOrd<DevSplit> for Dev64 {
1128 fn partial_cmp(&self, other: &DevSplit) -> Option<core::cmp::Ordering> {
1129 match self.major().partial_cmp(&other.major()) {
1130 Some(core::cmp::Ordering::Equal) => {}
1131 ord => return ord,
1132 }
1133 self.minor().partial_cmp(&other.minor())
1134 }
1135
1136 fn lt(&self, other: &DevSplit) -> bool {
1137 match self.major().cmp(&other.major()) {
1138 core::cmp::Ordering::Equal => (),
1139 core::cmp::Ordering::Less => return true,
1140 _ => return false,
1141 }
1142 self.minor().lt(&other.minor())
1143 }
1144
1145 fn le(&self, other: &DevSplit) -> bool {
1146 match self.major().cmp(&other.major()) {
1147 core::cmp::Ordering::Equal => (),
1148 core::cmp::Ordering::Less => return true,
1149 _ => return false,
1150 }
1151 self.minor().le(&other.minor())
1152 }
1153
1154 fn gt(&self, other: &DevSplit) -> bool {
1155 match self.major().cmp(&other.major()) {
1156 core::cmp::Ordering::Equal => (),
1157 core::cmp::Ordering::Greater => return true,
1158 _ => return false,
1159 }
1160 self.minor().gt(&other.minor())
1161 }
1162
1163 fn ge(&self, other: &DevSplit) -> bool {
1164 match self.major().cmp(&other.major()) {
1165 core::cmp::Ordering::Equal => (),
1166 core::cmp::Ordering::Greater => return true,
1167 _ => return false,
1168 }
1169 self.minor().ge(&other.minor())
1170 }
1171}
1172
1173impl PartialOrd<(u32, u32)> for Dev64 {
1174 fn partial_cmp(&self, other: &(u32, u32)) -> Option<core::cmp::Ordering> {
1175 match self.major().partial_cmp(&other.0) {
1176 Some(core::cmp::Ordering::Equal) => {}
1177 ord => return ord,
1178 }
1179 self.minor().partial_cmp(&other.1)
1180 }
1181
1182 fn lt(&self, other: &(u32, u32)) -> bool {
1183 match self.major().cmp(&other.0) {
1184 core::cmp::Ordering::Equal => (),
1185 core::cmp::Ordering::Less => return true,
1186 _ => return false,
1187 }
1188 self.minor().lt(&other.1)
1189 }
1190
1191 fn le(&self, other: &(u32, u32)) -> bool {
1192 match self.major().cmp(&other.0) {
1193 core::cmp::Ordering::Equal => (),
1194 core::cmp::Ordering::Less => return true,
1195 _ => return false,
1196 }
1197 self.minor().le(&other.1)
1198 }
1199
1200 fn gt(&self, other: &(u32, u32)) -> bool {
1201 match self.major().cmp(&other.0) {
1202 core::cmp::Ordering::Equal => (),
1203 core::cmp::Ordering::Greater => return true,
1204 _ => return false,
1205 }
1206 self.minor().gt(&other.1)
1207 }
1208
1209 fn ge(&self, other: &(u32, u32)) -> bool {
1210 match self.major().cmp(&other.0) {
1211 core::cmp::Ordering::Equal => (),
1212 core::cmp::Ordering::Greater => return true,
1213 _ => return false,
1214 }
1215 self.minor().ge(&other.1)
1216 }
1217}
1218
1219impl PartialOrd<Dev> for Dev64 {
1220 fn partial_cmp(&self, other: &Dev) -> Option<core::cmp::Ordering> {
1221 match other {
1222 Dev::B32(d) => self.partial_cmp(d),
1223 Dev::Split(d) => self.partial_cmp(d),
1224 Dev::B64(d) => self.partial_cmp(d),
1225 }
1226 }
1227
1228 fn lt(&self, other: &Dev) -> bool {
1229 match other {
1230 Dev::B32(d) => self.lt(d),
1231 Dev::Split(d) => self.lt(d),
1232 Dev::B64(d) => self.lt(d),
1233 }
1234 }
1235
1236 fn le(&self, other: &Dev) -> bool {
1237 match other {
1238 Dev::B32(d) => self.le(d),
1239 Dev::Split(d) => self.le(d),
1240 Dev::B64(d) => self.le(d),
1241 }
1242 }
1243
1244 fn gt(&self, other: &Dev) -> bool {
1245 match other {
1246 Dev::B32(d) => self.gt(d),
1247 Dev::Split(d) => self.gt(d),
1248 Dev::B64(d) => self.gt(d),
1249 }
1250 }
1251
1252 fn ge(&self, other: &Dev) -> bool {
1253 match other {
1254 Dev::B32(d) => self.ge(d),
1255 Dev::Split(d) => self.ge(d),
1256 Dev::B64(d) => self.ge(d),
1257 }
1258 }
1259}
1260
1261impl Ord for Dev64 {
1262 #[inline]
1263 fn cmp(&self, other: &Self) -> core::cmp::Ordering {
1264 self.0.cmp(&other.0)
1265 }
1266}
1267
1268impl From<Dev64> for u64 {
1269 #[inline]
1270 fn from(value: Dev64) -> Self {
1271 value.as_u64()
1272 }
1273}
1274
1275#[derive(Copy, Clone)]
1277pub enum Dev {
1278 B32(Dev32),
1279 Split(DevSplit),
1280 B64(Dev64),
1281}
1282
1283impl Dev {
1284 #[inline]
1286 pub const fn major(&self) -> u32 {
1287 match self {
1288 Self::B32(d) => d.major(),
1289 Self::Split(d) => d.major(),
1290 Self::B64(d) => d.major(),
1291 }
1292 }
1293
1294 #[inline]
1296 pub const fn minor(&self) -> u32 {
1297 match self {
1298 Self::B32(d) => d.minor(),
1299 Self::Split(d) => d.minor(),
1300 Self::B64(d) => d.minor(),
1301 }
1302 }
1303
1304 #[inline]
1306 pub const fn as_u64(&self) -> u64 {
1307 match self {
1308 Self::B32(d) => d.as_u64(),
1309 Self::Split(d) => d.as_u64(),
1310 Self::B64(d) => d.as_u64(),
1311 }
1312 }
1313
1314 #[inline]
1316 pub const fn from_u32(value: u32) -> Self {
1317 Self::B32(Dev32::new(value))
1318 }
1319
1320 #[inline]
1322 pub const fn from_u64(value: u64) -> Self {
1323 Self::B64(Dev64::new(value))
1324 }
1325
1326 #[inline]
1328 pub const fn from_split(major: u32, minor: u32) -> Self {
1329 Self::Split(DevSplit::new(major, minor))
1330 }
1331}
1332
1333impl fmt::Debug for Dev {
1334 #[inline]
1335 fn fmt(&self, f: &mut fmt::Formatter<'_>) -> fmt::Result {
1336 write!(f, "Dev({}:{})", self.major(), self.minor())
1337 }
1338}
1339
1340impl core::hash::Hash for Dev {
1341 #[inline]
1342 fn hash<H: core::hash::Hasher>(&self, state: &mut H) {
1343 self.as_u64().hash(state);
1344 }
1345}
1346
1347impl PartialEq for Dev {
1348 fn eq(&self, other: &Self) -> bool {
1349 match self {
1350 Dev::B32(d) => d.eq(other),
1351 Dev::Split(d) => d.eq(other),
1352 Dev::B64(d) => d.eq(other),
1353 }
1354 }
1355
1356 fn ne(&self, other: &Self) -> bool {
1357 match self {
1358 Dev::B32(d) => d.ne(other),
1359 Dev::Split(d) => d.ne(other),
1360 Dev::B64(d) => d.ne(other),
1361 }
1362 }
1363}
1364
1365impl PartialEq<Dev32> for Dev {
1366 fn eq(&self, other: &Dev32) -> bool {
1367 match self {
1368 Dev::B32(d) => d.eq(other),
1369 Dev::Split(d) => d.eq(other),
1370 Dev::B64(d) => d.eq(other),
1371 }
1372 }
1373
1374 fn ne(&self, other: &Dev32) -> bool {
1375 match self {
1376 Dev::B32(d) => d.ne(other),
1377 Dev::Split(d) => d.ne(other),
1378 Dev::B64(d) => d.ne(other),
1379 }
1380 }
1381}
1382
1383impl PartialEq<Dev64> for Dev {
1384 fn eq(&self, other: &Dev64) -> bool {
1385 match self {
1386 Dev::B32(d) => d.eq(other),
1387 Dev::Split(d) => d.eq(other),
1388 Dev::B64(d) => d.eq(other),
1389 }
1390 }
1391
1392 fn ne(&self, other: &Dev64) -> bool {
1393 match self {
1394 Dev::B32(d) => d.ne(other),
1395 Dev::Split(d) => d.ne(other),
1396 Dev::B64(d) => d.ne(other),
1397 }
1398 }
1399}
1400
1401impl PartialEq<DevSplit> for Dev {
1402 fn eq(&self, other: &DevSplit) -> bool {
1403 match self {
1404 Dev::B32(d) => d.eq(other),
1405 Dev::Split(d) => d.eq(other),
1406 Dev::B64(d) => d.eq(other),
1407 }
1408 }
1409
1410 fn ne(&self, other: &DevSplit) -> bool {
1411 match self {
1412 Dev::B32(d) => d.ne(other),
1413 Dev::Split(d) => d.ne(other),
1414 Dev::B64(d) => d.ne(other),
1415 }
1416 }
1417}
1418
1419impl PartialEq<u32> for Dev {
1420 #[inline]
1421 fn eq(&self, other: &u32) -> bool {
1422 self.eq(&Dev32::new(*other))
1423 }
1424
1425 #[inline]
1426 fn ne(&self, other: &u32) -> bool {
1427 self.ne(&Dev32::new(*other))
1428 }
1429}
1430
1431impl PartialEq<(u32, u32)> for Dev {
1432 #[inline]
1433 fn eq(&self, other: &(u32, u32)) -> bool {
1434 self.eq(&DevSplit::new(other.0, other.1))
1435 }
1436
1437 #[inline]
1438 fn ne(&self, other: &(u32, u32)) -> bool {
1439 self.ne(&DevSplit::new(other.0, other.1))
1440 }
1441}
1442
1443impl PartialEq<u64> for Dev {
1444 #[inline]
1445 fn eq(&self, other: &u64) -> bool {
1446 self.eq(&Dev64::new(*other))
1447 }
1448
1449 #[inline]
1450 fn ne(&self, other: &u64) -> bool {
1451 self.ne(&Dev64::new(*other))
1452 }
1453}
1454
1455impl Eq for Dev {}
1456
1457impl PartialOrd for Dev {
1458 #[inline]
1459 fn partial_cmp(&self, other: &Self) -> Option<core::cmp::Ordering> {
1460 Some(self.cmp(other))
1461 }
1462
1463 fn lt(&self, other: &Self) -> bool {
1464 match self {
1465 Self::B32(d) => d.lt(other),
1466 Self::Split(d) => d.lt(other),
1467 Self::B64(d) => d.lt(other),
1468 }
1469 }
1470
1471 fn le(&self, other: &Self) -> bool {
1472 match self {
1473 Self::B32(d) => d.le(other),
1474 Self::Split(d) => d.le(other),
1475 Self::B64(d) => d.le(other),
1476 }
1477 }
1478
1479 fn gt(&self, other: &Self) -> bool {
1480 match self {
1481 Self::B32(d) => d.gt(other),
1482 Self::Split(d) => d.gt(other),
1483 Self::B64(d) => d.gt(other),
1484 }
1485 }
1486
1487 fn ge(&self, other: &Self) -> bool {
1488 match self {
1489 Self::B32(d) => d.ge(other),
1490 Self::Split(d) => d.ge(other),
1491 Self::B64(d) => d.ge(other),
1492 }
1493 }
1494}
1495
1496impl PartialOrd<Dev32> for Dev {
1497 fn partial_cmp(&self, other: &Dev32) -> Option<core::cmp::Ordering> {
1498 match self {
1499 Self::B32(d) => d.partial_cmp(other),
1500 Self::Split(d) => d.partial_cmp(other),
1501 Self::B64(d) => d.partial_cmp(other),
1502 }
1503 }
1504
1505 fn lt(&self, other: &Dev32) -> bool {
1506 match self {
1507 Self::B32(d) => d.lt(other),
1508 Self::Split(d) => d.lt(other),
1509 Self::B64(d) => d.lt(other),
1510 }
1511 }
1512
1513 fn le(&self, other: &Dev32) -> bool {
1514 match self {
1515 Self::B32(d) => d.le(other),
1516 Self::Split(d) => d.le(other),
1517 Self::B64(d) => d.le(other),
1518 }
1519 }
1520
1521 fn gt(&self, other: &Dev32) -> bool {
1522 match self {
1523 Self::B32(d) => d.gt(other),
1524 Self::Split(d) => d.gt(other),
1525 Self::B64(d) => d.gt(other),
1526 }
1527 }
1528
1529 fn ge(&self, other: &Dev32) -> bool {
1530 match self {
1531 Self::B32(d) => d.ge(other),
1532 Self::Split(d) => d.ge(other),
1533 Self::B64(d) => d.ge(other),
1534 }
1535 }
1536}
1537
1538impl PartialOrd<u32> for Dev {
1539 fn partial_cmp(&self, other: &u32) -> Option<core::cmp::Ordering> {
1540 match self {
1541 Self::B32(d) => d.partial_cmp(other),
1542 Self::Split(d) => d.partial_cmp(other),
1543 Self::B64(d) => d.partial_cmp(other),
1544 }
1545 }
1546
1547 fn lt(&self, other: &u32) -> bool {
1548 match self {
1549 Self::B32(d) => d.lt(other),
1550 Self::Split(d) => d.lt(other),
1551 Self::B64(d) => d.lt(other),
1552 }
1553 }
1554
1555 fn le(&self, other: &u32) -> bool {
1556 match self {
1557 Self::B32(d) => d.le(other),
1558 Self::Split(d) => d.le(other),
1559 Self::B64(d) => d.le(other),
1560 }
1561 }
1562
1563 fn gt(&self, other: &u32) -> bool {
1564 match self {
1565 Self::B32(d) => d.gt(other),
1566 Self::Split(d) => d.gt(other),
1567 Self::B64(d) => d.gt(other),
1568 }
1569 }
1570
1571 fn ge(&self, other: &u32) -> bool {
1572 match self {
1573 Self::B32(d) => d.ge(other),
1574 Self::Split(d) => d.ge(other),
1575 Self::B64(d) => d.ge(other),
1576 }
1577 }
1578}
1579
1580impl PartialOrd<DevSplit> for Dev {
1581 fn partial_cmp(&self, other: &DevSplit) -> Option<core::cmp::Ordering> {
1582 match self {
1583 Self::B32(d) => d.partial_cmp(other),
1584 Self::Split(d) => d.partial_cmp(other),
1585 Self::B64(d) => d.partial_cmp(other),
1586 }
1587 }
1588
1589 fn lt(&self, other: &DevSplit) -> bool {
1590 match self {
1591 Self::B32(d) => d.lt(other),
1592 Self::Split(d) => d.lt(other),
1593 Self::B64(d) => d.lt(other),
1594 }
1595 }
1596
1597 fn le(&self, other: &DevSplit) -> bool {
1598 match self {
1599 Self::B32(d) => d.le(other),
1600 Self::Split(d) => d.le(other),
1601 Self::B64(d) => d.le(other),
1602 }
1603 }
1604
1605 fn gt(&self, other: &DevSplit) -> bool {
1606 match self {
1607 Self::B32(d) => d.gt(other),
1608 Self::Split(d) => d.gt(other),
1609 Self::B64(d) => d.gt(other),
1610 }
1611 }
1612
1613 fn ge(&self, other: &DevSplit) -> bool {
1614 match self {
1615 Self::B32(d) => d.ge(other),
1616 Self::Split(d) => d.ge(other),
1617 Self::B64(d) => d.ge(other),
1618 }
1619 }
1620}
1621
1622impl PartialOrd<(u32, u32)> for Dev {
1623 fn partial_cmp(&self, other: &(u32, u32)) -> Option<core::cmp::Ordering> {
1624 match self {
1625 Self::B32(d) => d.partial_cmp(other),
1626 Self::Split(d) => d.partial_cmp(other),
1627 Self::B64(d) => d.partial_cmp(other),
1628 }
1629 }
1630
1631 fn lt(&self, other: &(u32, u32)) -> bool {
1632 match self {
1633 Self::B32(d) => d.lt(other),
1634 Self::Split(d) => d.lt(other),
1635 Self::B64(d) => d.lt(other),
1636 }
1637 }
1638
1639 fn le(&self, other: &(u32, u32)) -> bool {
1640 match self {
1641 Self::B32(d) => d.le(other),
1642 Self::Split(d) => d.le(other),
1643 Self::B64(d) => d.le(other),
1644 }
1645 }
1646
1647 fn gt(&self, other: &(u32, u32)) -> bool {
1648 match self {
1649 Self::B32(d) => d.gt(other),
1650 Self::Split(d) => d.gt(other),
1651 Self::B64(d) => d.gt(other),
1652 }
1653 }
1654
1655 fn ge(&self, other: &(u32, u32)) -> bool {
1656 match self {
1657 Self::B32(d) => d.ge(other),
1658 Self::Split(d) => d.ge(other),
1659 Self::B64(d) => d.ge(other),
1660 }
1661 }
1662}
1663
1664impl PartialOrd<Dev64> for Dev {
1665 fn partial_cmp(&self, other: &Dev64) -> Option<core::cmp::Ordering> {
1666 match self {
1667 Self::B32(d) => d.partial_cmp(other),
1668 Self::Split(d) => d.partial_cmp(other),
1669 Self::B64(d) => d.partial_cmp(other),
1670 }
1671 }
1672
1673 fn lt(&self, other: &Dev64) -> bool {
1674 match self {
1675 Self::B32(d) => d.lt(other),
1676 Self::Split(d) => d.lt(other),
1677 Self::B64(d) => d.lt(other),
1678 }
1679 }
1680
1681 fn le(&self, other: &Dev64) -> bool {
1682 match self {
1683 Self::B32(d) => d.le(other),
1684 Self::Split(d) => d.le(other),
1685 Self::B64(d) => d.le(other),
1686 }
1687 }
1688
1689 fn gt(&self, other: &Dev64) -> bool {
1690 match self {
1691 Self::B32(d) => d.gt(other),
1692 Self::Split(d) => d.gt(other),
1693 Self::B64(d) => d.gt(other),
1694 }
1695 }
1696
1697 fn ge(&self, other: &Dev64) -> bool {
1698 match self {
1699 Self::B32(d) => d.ge(other),
1700 Self::Split(d) => d.ge(other),
1701 Self::B64(d) => d.ge(other),
1702 }
1703 }
1704}
1705
1706impl PartialOrd<u64> for Dev {
1707 fn partial_cmp(&self, other: &u64) -> Option<core::cmp::Ordering> {
1708 match self {
1709 Self::B32(d) => d.partial_cmp(other),
1710 Self::Split(d) => d.partial_cmp(other),
1711 Self::B64(d) => d.partial_cmp(other),
1712 }
1713 }
1714
1715 fn lt(&self, other: &u64) -> bool {
1716 match self {
1717 Self::B32(d) => d.lt(other),
1718 Self::Split(d) => d.lt(other),
1719 Self::B64(d) => d.lt(other),
1720 }
1721 }
1722
1723 fn le(&self, other: &u64) -> bool {
1724 match self {
1725 Self::B32(d) => d.le(other),
1726 Self::Split(d) => d.le(other),
1727 Self::B64(d) => d.le(other),
1728 }
1729 }
1730
1731 fn gt(&self, other: &u64) -> bool {
1732 match self {
1733 Self::B32(d) => d.gt(other),
1734 Self::Split(d) => d.gt(other),
1735 Self::B64(d) => d.gt(other),
1736 }
1737 }
1738
1739 fn ge(&self, other: &u64) -> bool {
1740 match self {
1741 Self::B32(d) => d.ge(other),
1742 Self::Split(d) => d.ge(other),
1743 Self::B64(d) => d.ge(other),
1744 }
1745 }
1746}
1747
1748impl Ord for Dev {
1749 fn cmp(&self, other: &Self) -> core::cmp::Ordering {
1750 match self.major().cmp(&other.major()) {
1751 core::cmp::Ordering::Equal => {}
1752 ord => return ord,
1753 }
1754 self.minor().cmp(&other.minor())
1755 }
1756}
1757
1758impl From<Dev32> for Dev {
1759 #[inline]
1760 fn from(value: Dev32) -> Self {
1761 Self::B32(value)
1762 }
1763}
1764
1765impl From<DevSplit> for Dev {
1766 #[inline]
1767 fn from(value: DevSplit) -> Self {
1768 Self::Split(value)
1769 }
1770}
1771
1772impl From<Dev64> for Dev {
1773 #[inline]
1774 fn from(value: Dev64) -> Self {
1775 Self::B64(value)
1776 }
1777}
1778
1779impl From<u32> for Dev {
1780 #[inline]
1781 fn from(value: u32) -> Self {
1782 Self::from_u32(value)
1783 }
1784}
1785
1786impl From<u64> for Dev {
1787 #[inline]
1788 fn from(value: u64) -> Self {
1789 Self::from_u64(value)
1790 }
1791}
1792
1793impl From<(u32, u32)> for Dev {
1794 #[inline]
1795 fn from(value: (u32, u32)) -> Self {
1796 Self::from_split(value.0, value.1)
1797 }
1798}
1799
1800impl From<Dev> for u64 {
1801 #[inline]
1802 fn from(value: Dev) -> Self {
1803 value.as_u64()
1804 }
1805}