-
-
Notifications
You must be signed in to change notification settings - Fork 20
Expand file tree
/
Copy pathbinary_version.rs
More file actions
20 lines (16 loc) · 643 Bytes
/
binary_version.rs
File metadata and controls
20 lines (16 loc) · 643 Bytes
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
use derive_more::{AsMut, AsRef, From, FromStr, Into};
#[cfg(feature = "json")]
use serde::{Deserialize, Serialize};
/// Version of the current `pdu` program.
pub const CURRENT_VERSION: &str = env!("CARGO_PKG_VERSION");
/// Version of the `pdu` program that created the input JSON.
#[derive(Debug, Clone, PartialEq, Eq, AsRef, AsMut, From, Into, FromStr)]
#[cfg_attr(feature = "json", derive(Deserialize, Serialize))]
pub struct BinaryVersion(String);
impl BinaryVersion {
/// Get version of the current `pdu` program as a `BinaryVersion`.
#[inline]
pub fn current() -> Self {
CURRENT_VERSION.to_string().into()
}
}