server/domain/types/card/
rank.rs1use serde::{Deserialize, Serialize};
2
3#[derive(Clone, Copy, Debug, PartialEq, Eq, PartialOrd, Ord, Hash, Serialize, Deserialize)]
7#[repr(transparent)]
8#[serde(transparent)]
9pub struct Rank(usize);
10
11impl From<usize> for Rank {
12 fn from(value: usize) -> Self {
13 Self(value)
14 }
15}
16
17impl std::ops::Add<usize> for Rank {
18 type Output = Rank;
19
20 fn add(self, rhs: usize) -> Self::Output {
21 Self(self.0 + rhs)
22 }
23}
24
25impl std::ops::Sub for Rank {
26 type Output = usize;
27
28 fn sub(self, rhs: Self) -> Self::Output {
29 self.0 - rhs.0
30 }
31}