diff options
author | Jesse Luehrs <doy@tozt.net> | 2020-05-21 23:42:27 -0400 |
---|---|---|
committer | Jesse Luehrs <doy@tozt.net> | 2020-05-21 23:42:27 -0400 |
commit | 318413b119c5f0e988079bb7bede1a4a86583a7a (patch) | |
tree | eb68345d61f86321986188fbd2382fff6cb7e166 /src/protocol.rs | |
parent | 41123157c6d356006af12425863f003a4dc87f3d (diff) | |
download | rbw-318413b119c5f0e988079bb7bede1a4a86583a7a.tar.gz rbw-318413b119c5f0e988079bb7bede1a4a86583a7a.zip |
use the crate version for the protocol version
Diffstat (limited to 'src/protocol.rs')
-rw-r--r-- | src/protocol.rs | 12 |
1 files changed, 11 insertions, 1 deletions
diff --git a/src/protocol.rs b/src/protocol.rs index cf0c278..68506b2 100644 --- a/src/protocol.rs +++ b/src/protocol.rs @@ -1,4 +1,14 @@ -pub const VERSION: u32 = 3; +// eventually it would be nice to make this a const function so that we could +// just get the version from a variable directly, but this is fine for now +pub fn version() -> u32 { + let major = env!("CARGO_PKG_VERSION_MAJOR"); + let minor = env!("CARGO_PKG_VERSION_MINOR"); + let patch = env!("CARGO_PKG_VERSION_PATCH"); + + major.parse::<u32>().unwrap() * 1_000_000 + + minor.parse::<u32>().unwrap() * 1_000 + + patch.parse::<u32>().unwrap() +} #[derive(serde::Serialize, serde::Deserialize, Debug)] pub struct Request { |