1pub const VERSION: &str = env!("CARGO_PKG_VERSION");
2pub const MESSAGE_FORMAT_VERSION: u32 = 1;
3pub const CONFIG_FORMAT_VERSION: u32 = 1;
4pub const STORAGE_SCHEMA_VERSION: u32 = 1;
5
6#[derive(Clone, Debug)]
7pub struct VersionInfo {
8 pub version: &'static str,
9 pub message_format: u32,
10 pub config_format: u32,
11 pub storage_schema: u32,
12 pub git_hash: Option<&'static str>,
13 pub build_time: Option<&'static str>,
14}
15
16impl VersionInfo {
17 pub fn current() -> Self {
18 Self {
19 version: VERSION,
20 message_format: MESSAGE_FORMAT_VERSION,
21 config_format: CONFIG_FORMAT_VERSION,
22 storage_schema: STORAGE_SCHEMA_VERSION,
23 git_hash: option_env!("GIT_HASH"),
24 build_time: option_env!("BUILD_TIME"),
25 }
26 }
27}