exfat/
types.rs

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<I: Into<u64>> core::ops::Add<I> for SectorID {
7    type Output = Self;
8
9    fn add(self, rhs: I) -> Self {
10        Self(self.0 + rhs.into())
11    }
12}
13
14impl<I: Into<u64>> core::ops::AddAssign<I> for SectorID {
15    fn add_assign(&mut self, rhs: I) {
16        self.0 += rhs.into()
17    }
18}
19
20#[derive(Copy, Clone, Debug, Default, Display, From, Into, Eq, Ord, PartialOrd, PartialEq)]
21pub struct ClusterID(u32);
22
23impl ClusterID {
24    pub fn valid(&self) -> bool {
25        return self.0 > 0;
26    }
27}
28
29impl<I: Into<u32>> core::ops::Add<I> for ClusterID {
30    type Output = Self;
31
32    fn add(self, rhs: I) -> Self {
33        Self(self.0 + rhs.into())
34    }
35}
36
37impl<I: Into<u32>> core::ops::AddAssign<I> for ClusterID {
38    fn add_assign(&mut self, rhs: I) {
39        self.0 += rhs.into()
40    }
41}