1use derive_more::{Display, From, Into};
2
3#[derive(Copy, Clone, Debug, Default, Display, From, Into, Eq, Ord, PartialOrd, PartialEq)]
4pub struct SectorID(u64);
5
6impl SectorID {
7 pub(crate) const BOOT: Self = Self(0);
8}
9
10impl<I: Into<u64>> core::ops::Add<I> for SectorID {
11 type Output = Self;
12
13 fn add(self, rhs: I) -> Self {
14 Self(self.0 + rhs.into())
15 }
16}
17
18impl<I: Into<u64>> core::ops::AddAssign<I> for SectorID {
19 fn add_assign(&mut self, rhs: I) {
20 self.0 += rhs.into()
21 }
22}
23
24#[derive(Copy, Clone, Debug, Default, Display, From, Into, Eq, Ord, PartialOrd, PartialEq)]
25pub struct ClusterID(u32);
26
27impl ClusterID {
28 pub(crate) const FIRST: Self = Self(2);
29
30 pub fn valid(&self) -> bool {
31 return self.0 > 0;
32 }
33
34 pub(crate) fn offset(self) -> u32 {
35 self.0 - Self::FIRST.0
36 }
37}
38
39impl<I: Into<u32>> core::ops::Add<I> for ClusterID {
40 type Output = Self;
41
42 fn add(self, rhs: I) -> Self {
43 Self(self.0 + rhs.into())
44 }
45}
46
47impl<I: Into<u32>> core::ops::AddAssign<I> for ClusterID {
48 fn add_assign(&mut self, rhs: I) {
49 self.0 += rhs.into()
50 }
51}