Skip to content

Commit

Permalink
Merge pull request #23 from EspressoSystems/make_static_version_debug…
Browse files Browse the repository at this point in the history
…_for_metrics

StaticVersion can be Debug
  • Loading branch information
nyospe authored Feb 27, 2024
2 parents 2bb9b0b + 999ea8f commit 55abe32
Showing 1 changed file with 15 additions and 0 deletions.
15 changes: 15 additions & 0 deletions src/version.rs
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
use anyhow::anyhow;
use core::fmt::Debug;
use displaydoc::Display;
use serde::{Deserialize, Serialize};

Expand Down Expand Up @@ -34,3 +35,17 @@ impl Version {
}

pub struct StaticVersion<const MAJOR: u16, const MINOR: u16>;

impl<const MAJOR: u16, const MINOR: u16> StaticVersion<MAJOR, MINOR> {
pub const MAJOR: u16 = MAJOR;
pub const MINOR: u16 = MINOR;
}

impl<const MAJOR: u16, const MINOR: u16> Debug for StaticVersion<MAJOR, MINOR> {
fn fmt(&self, f: &mut std::fmt::Formatter<'_>) -> std::fmt::Result {
f.debug_struct("StaticVersion<MAJOR, MINOR>")
.field("MAJOR", &Self::MAJOR)
.field("MINOR", &Self::MINOR)
.finish()
}
}

0 comments on commit 55abe32

Please sign in to comment.