1use std::fmt::Display;
18use std::str::FromStr;
19
20use serde::Deserialize;
21use serde::Serialize;
22
23#[derive(
24 Debug, Copy, Clone, Hash, Default, PartialEq, Eq, PartialOrd, Ord, Deserialize, Serialize,
25)]
26#[cfg_attr(feature = "arbitrary", derive(arbitrary::Arbitrary))]
27#[repr(transparent)]
28#[serde(transparent)]
29pub struct ProofIdx(u64);
30
31impl ProofIdx {
32 pub fn zero() -> Self {
33 Self(0)
34 }
35
36 pub fn increment(&mut self) {
37 self.0 += 1;
38 }
39}
40
41impl Display for ProofIdx {
42 fn fmt(&self, f: &mut std::fmt::Formatter<'_>) -> std::fmt::Result {
43 write!(f, "{}", self.0)
44 }
45}
46
47impl FromStr for ProofIdx {
48 type Err = <u64 as FromStr>::Err;
49
50 fn from_str(s: &str) -> Result<Self, Self::Err> {
51 u64::from_str(s).map(ProofIdx)
52 }
53}